OpenControl

hh hh at livecode.org
Mon Aug 4 16:55:46 EDT 2014


> Paul wrote:
> I'd expect this just to work for user events, system events bypass
> controls and groups.

YES it works. You know I'm now nearly "experienced" (3/2 years with LC). But this was *very* soon for me one of the finest things in LC (and could even enhanced by using 'behavior'): Using the message path by a background group.

If I have for example a stack without titlebar that has substacks and all have one to N cards. Then I make a backGround group and place this on every card of the mainstack -- invisible and containing an 16x16 image, nothing else.
Then I write ONE dragHandler (the usual one) in the group and can now drag the stack window on every card and on every card of every substack that passes mouseDown (with setting the cursor to this image while dragging).

And/or
I write ONE mouseEnter handler in that group that receives (being visible or not) every mouseEnter of every object that passes mouseEnter (we had a similar thread recently in the forum). Try this in the groups script:

-- Instead of msg and clipboard you could use a grouped (visible) field
on mouseEnter
 if the tool is "pointer tool" and the optionkey is up then
   if the shiftkey is down then set clipboardData["text"] to the target
   put the internet date &": "& the target -- into fld "devInfo"
 end if
 pass mouseEnter
end mouseEnter

Now choose the pointer tool when going to scriptEditor.
If you need the name of a control you wish to insert as target in a script then
(read this with all parentheses or without all parentheses):

1) point the control with the cursor (with shiftKey down for copying)
2) hold (additionally) the optionKey down -- to 'fix' current info
3) move the cursor back over your script and release keys (and paste)

To block this, handle mouseEnter in the main stack's script by not passing it, it's not required to touch the background group's script.

Hermann





More information about the use-livecode mailing list