The owner of a selected control - a mystery

Graham Samuel livfoss at mac.com
Sat Feb 21 11:11:03 EST 2015


Thanks Richard

I see what you are saying. I tried to report what I saw as a bug and my test stack revealed some other problems. So there is a bug report now, 14648, but it only obliquely refers to the stuff I recently posted!

Incidentally, (please skip this as being OT for the current conversation if you’re busy!) this was all an attempt to send pictures of cards as PDFs, where Terry Judd and others showed me the way to go. I got into a bit of a mess as my script got more complicated. I have  however noted the following during this process:

1. When you print to a pdf file, you often get a blank page. I have not yet found that the solution offered (putting a ‘print break’ into the script) works for me.

2, When you print to a pdf file and use a name you’ve used before, the engine doesn’t offer a way of telling the user that this is so, and offering the option to overwrite or change the name. This is something to do with the way the OS dialog is invoked, I suspect. Of course the script can do the check itself by checking for the existence of the named file, but it seems odd.

3. There is a warning somewhere in the Dictionary that if a script makes a group from a set of selected objects, identifying it by using 'the ID of the last group’ doesn’t always work. I think I can confirm this. I could not however find a bug report in the database. I have timed out for the present, but I hope to have time to investigate further. Oddly, selecting stuff and then grouping it always works in the IDE.

Graham

on a wet Sunday afternoon in France


> On 21 Feb 2015, at 16:31, Richard Gaskin <ambassador at fourthworld.com> wrote:
> 
> Graham Samuel wrote:
> 
> ...
> >   set the selected to empty
> >
> > This last statement resulted in an execution error: “controls don’t
> > have the same owner”.
> 
> I get a different error, "can't find object", which I would expected because "selected" is an object property, not a global property.
> 
> To deselect all objects use "select empty", or loop through all controls with something like:
> 
> on DeselectAll
>  repeat with i = 1 to the number of controls
>     set the selected of control i to false
>  end repeat
> end DeselectAll
> 
> "select empty" will probably be much faster, and certainly simpler to type.
> 
> 
> >... 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.
> 
> This one's a gray area.
> 
> The selectedObject resolves to an object reference, so as written it seems the engine is attempting to get the number of lines in the object itself (the text property) rather than the object reference string.
> 
> To force evaluation to operate on the list of objects rather than the object itself, using parentheses seems to do the trick:
> 
>  put the number of lines of (the selectedObject)
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for Desktop, Mobile, and Web
> ____________________________________________________________
> Ambassador at FourthWorld.com        http://www.FourthWorld.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list