The owner of a selected control - a mystery

Graham Samuel livfoss at
Sat Feb 21 06:47:07 EST 2015

Using LC 7.0.2 rc-2, I was trying to implement a ‘select all’ function by using loops to select each type of object on a card which contains the full gamut - fields, graphics, images, buttons and groups. This worked as far as I can see, and after doing all the selecting, I was able to group the selected objects (you just script ‘group’ without any parameters). However, after doing my planned action with these objects (I just wanted to move them a certain distance on the card), I wanted to reverse the situation, firstly by ungrouping the last group (I have stored its ID) and then by doing

    set the selected to empty

This last statement resulted in an execution error: “controls don’t have the same owner”. 

After a lot of experimentation, I found out that this error came from the fact that the card contains groups, and I had selected the objects within the groups as well as the groups themselves (how could I not?). So although the owner of each group is the card, the owner of the objects within each group is the group itself.

So the error is explained, but it seems to me meaningless. If I can select everything on a card and make a well-ordered list of the selected objects (‘the selectedObject') then why in the name of any deity you like to mention should it be an error to deselect them?

Do people agree that this is a bug, or at best an unwanted feature? Can anyone suggest what purpose it might serve?

A further ‘interesting’ fact. If one goes through a selection process of this kind, and uses the message box to look at the selectedObject, one sees a list, as described in the LC Dictionary, with each selected object’s reference on a separate line. But if you put

 put the number of lines of the selectedObject

into the message box, you get zilch (actually I think you get the error described earlier, but I can’t see it). But if you put

  put the selectedObject into temp
  put the number of lines of temp

You get an integer, as expected. Now that really is a bug, as far as I can see. Guess I’d better report it.



More information about the use-livecode mailing list