Palettes and the selectedObject

Peter M. Brigham pmbrig at gmail.com
Tue Nov 4 15:17:28 EST 2014


On Nov 3, 2014, at 10:26 AM, Richard Gaskin wrote:

> Graham Samuel wrote:
> > If I am keying in a field in an ordinary stack window and I stop
> > to do something on a palette, I had hoped that the focusedObject
> > would remain in the ordinary stack - however it turns out that
> > the focusedObject is now the visible card of the palette. Does
> > this mean that the previous focusedObject is lost and thus I
> > can't use a palette to do an insertion in the field in the ordinary
> > stack? Looks like it.
> 
> Are you using an editable text field in your palette, or just clicking buttons?
> 
> If just buttons remember to turn off the traversalOn property and you should be fine.
> 
> For editable fields it's a different story, since LiveCode currently maintains the xTalk tradition of allowing only one editable field at a time.  Would be nice to see that changed, but I imagine it's tricky, not just in engineering but in syntax.

My workaround is to put the following into the script of the field in the palette stack:

local theFocusedObj

on mouseenter
   put the long id of the focusedObject into theFocusedObj
   pass mouseenter
end mouseenter

Then you can use theFocusedObj for whatever you need in your mouseup or closefield scripts.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the use-livecode mailing list