Mouse & Group Interaction
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Mouse & Group Interaction
Mouse interaction when working with Groups seems weird to me.
It appears that even though a set of controls is grouped, the mouse events (enter, leave, scrollwheel (rawkeykeydown)) only fire when the mouse location intersects one of the controls in the group, rather than with the group's 'area'.
This seems especially odd when the group's size is locked and scrollbars are used, since visually there's a an area of 'control' that is unresponsive.
So, given a set of controls that has been grouped, will need to be scrolled, and has a moderate amount of empty space between and around the controls, what can I do to make the group 'area' respond to the mouse (especially the scroll functionality)?
I found this old thread, but couldn't glean the solution from it.
It appears that even though a set of controls is grouped, the mouse events (enter, leave, scrollwheel (rawkeykeydown)) only fire when the mouse location intersects one of the controls in the group, rather than with the group's 'area'.
This seems especially odd when the group's size is locked and scrollbars are used, since visually there's a an area of 'control' that is unresponsive.
So, given a set of controls that has been grouped, will need to be scrolled, and has a moderate amount of empty space between and around the controls, what can I do to make the group 'area' respond to the mouse (especially the scroll functionality)?
I found this old thread, but couldn't glean the solution from it.
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Mouse & Group Interaction
Check the grouping.
There may be more than one.
Two groups - grouped together - to make a third.
One group embeded within another.
One group layered on top of another.
I had an error in the script in one of the controls within the group
drove me mad until I found it.
Try placing the group into a container.
And writing code for the container.
I havn't tried this yet.
Don't forget the
Pass MouseMove - I still need to research to be sure what this is for
hth
There may be more than one.
Two groups - grouped together - to make a third.
One group embeded within another.
One group layered on top of another.
I had an error in the script in one of the controls within the group
drove me mad until I found it.
Try placing the group into a container.
And writing code for the container.
I havn't tried this yet.
Don't forget the
Pass MouseMove - I still need to research to be sure what this is for
hth
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Re: Mouse & Group Interaction
I was going to reply before reading the old thread you linked, saying you need to put (say) an image into the group to act as a catcher for mouse events. Having read the old thread, my answer is the same but I'll try and explain a little more.
To react to a mouse event, there needs to be something to receive the mouse event at its current location. Controls that do not have any "physical presence" - ie, the space between your other buttons and controls in the group - (or, I believe, disabled controls) do not receive events. This is desirable on the whole, since the "rect" of a control may wildly vary from what you apparently believe its area to be from the visual display. You might otherwise get many objects being unclickable as the "transparent" area of a control on a higher layer would cover them.
In order to force a group area to react to mouse events over its whole area there needs to be something "physically" in its whole area, whether or not you can see it. Try making a plain white image (or for ease, an opaque rectangle graphic) and inserting that into the group and resize it to be the same as the group's rect. Then make sure that you give it the lowest layer of any group member, and that layer will receive any mouse events if the pointer is between any of the "properly" visible controls in the group area, and trigger the mouse event handlers held in the group script.
Now, to get the image/graphic out of sight so that it still "looks" transparent but will receive the events to be handled by the group script is the trick. If you set the blendLevel of the graphic to 100 then it will become "transparent" to the eye. The control will still be there though. * Now... apparently this is different from my recollection because I just tried (on Windows) and even though it "looks" *completely* transparent at blendLevel 100, it is still "there" and "visible" to mouse events.
*My previous experience (unless I'm wildly hallucinating, which is possible) is that you needed to set the blendLevel to 99 in order to have the control go "almost entirely transparent" so the eye could not see it, with the 1% left being enough for the mouse to believe it is "still there". I'm almost certain that it used to be the case that if you set the blendLevel to 100 then it becomes fully transparent and "is not there" - neither to eye nor mouse events.
To react to a mouse event, there needs to be something to receive the mouse event at its current location. Controls that do not have any "physical presence" - ie, the space between your other buttons and controls in the group - (or, I believe, disabled controls) do not receive events. This is desirable on the whole, since the "rect" of a control may wildly vary from what you apparently believe its area to be from the visual display. You might otherwise get many objects being unclickable as the "transparent" area of a control on a higher layer would cover them.
In order to force a group area to react to mouse events over its whole area there needs to be something "physically" in its whole area, whether or not you can see it. Try making a plain white image (or for ease, an opaque rectangle graphic) and inserting that into the group and resize it to be the same as the group's rect. Then make sure that you give it the lowest layer of any group member, and that layer will receive any mouse events if the pointer is between any of the "properly" visible controls in the group area, and trigger the mouse event handlers held in the group script.
Now, to get the image/graphic out of sight so that it still "looks" transparent but will receive the events to be handled by the group script is the trick. If you set the blendLevel of the graphic to 100 then it will become "transparent" to the eye. The control will still be there though. * Now... apparently this is different from my recollection because I just tried (on Windows) and even though it "looks" *completely* transparent at blendLevel 100, it is still "there" and "visible" to mouse events.
*My previous experience (unless I'm wildly hallucinating, which is possible) is that you needed to set the blendLevel to 99 in order to have the control go "almost entirely transparent" so the eye could not see it, with the 1% left being enough for the mouse to believe it is "still there". I'm almost certain that it used to be the case that if you set the blendLevel to 100 then it becomes fully transparent and "is not there" - neither to eye nor mouse events.
Re: Mouse & Group Interaction
Sparkout...
You don't need to alter the blendLevel, just set the ink of a graphic to 'noop'... you don't see it, but it will then catch messages
be well
Dixie
You don't need to alter the blendLevel, just set the ink of a graphic to 'noop'... you don't see it, but it will then catch messages
be well
Dixie
Re: Mouse & Group Interaction
Mmmm yeah. So I see. Admittedly it was about 4000 years ago I last played with a group control message catcher quite like this but...
Re: Mouse & Group Interaction
Hi dglass
here is a little example stack with a group that uses a graphic as "background" control.
check the groups script for the scrolling of the group. Also the target of a mouseDown is indicated. This does not work for the editable field since they don't get the message.
This work for scrolling with the magic mouse on a Mac, should work for other scrolling devices also. If the rawKey is different it might not work, just click into the editable field and move the scrollwhell of your mouse. The field at the right will indicate the rawKey number.
Kind regards
Bernd
here is a little example stack with a group that uses a graphic as "background" control.
check the groups script for the scrolling of the group. Also the target of a mouseDown is indicated. This does not work for the editable field since they don't get the message.
This work for scrolling with the magic mouse on a Mac, should work for other scrolling devices also. If the rawKey is different it might not work, just click into the editable field and move the scrollwhell of your mouse. The field at the right will indicate the rawKey number.
Kind regards
Bernd
- Attachments
-
- ScrollAGroupWithScoll.livecode.zip
- (1.71 KiB) Downloaded 278 times
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Mouse & Group Interaction
Getting late here ...
After a very long day of study and researching.
I was just reading something about mouseMove
and retrieving what control was under the mouse pointer
using the mouseChunk or mouseStack(? or something similar).
Use the mouseStack function to determine which window the mouse is over, or, in conjunction with the mouseControl, mouseLine, or mouseChunk, to determine which field the mouse is over.
After a very long day of study and researching.
I was just reading something about mouseMove
and retrieving what control was under the mouse pointer
using the mouseChunk or mouseStack(? or something similar).
Use the mouseStack function to determine which window the mouse is over, or, in conjunction with the mouseControl, mouseLine, or mouseChunk, to determine which field the mouse is over.
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Re: Mouse & Group Interaction
And your point is ?BarrySumpter wrote:Getting late here ...
After a very long day of study and researching.
I was just reading something about mouseMove
and retrieving what control was under the mouse pointer
using the mouseChunk or mouseStack(? or something similar).
Use the mouseStack function to determine which window the mouse is over, or, in conjunction with the mouseControl, mouseLine, or mouseChunk, to determine which field the mouse is over.
Re: Mouse & Group Interaction
Thanks everybody!
Mostly working now, just have to figure out the remaining issues.

Mostly working now, just have to figure out the remaining issues.

Re: Mouse & Group Interaction
OK, so 'remaining issues'....
The number of graphic elements and their positions in my group will be arbitrary so I need to be able to resize the 'controller' rectangle to encompass them all.
I have the resizing part handled, I think, but for some reason my graphic elements get moved around in ways that I'm not (as far as I can tell) moving them.
The attached stack starts with a single colored balloon and the controller rectangle in the group. Pressing the button creates 3 more balloons and positions them. Then it is supposed to resize the controller rectangle so it surrounds the balloons, and while it does resize, and the size is right to surround the balloons, all the balloons are shifted down and to the right of where they should be, so some are outside of the rectangle.
I'm not understanding why the Top property of the balloons is being adjusted. It's almost like the controller rectangle is growing along its top and left edges (so up and left) rather than at the bottom.
The number of graphic elements and their positions in my group will be arbitrary so I need to be able to resize the 'controller' rectangle to encompass them all.
I have the resizing part handled, I think, but for some reason my graphic elements get moved around in ways that I'm not (as far as I can tell) moving them.
The attached stack starts with a single colored balloon and the controller rectangle in the group. Pressing the button creates 3 more balloons and positions them. Then it is supposed to resize the controller rectangle so it surrounds the balloons, and while it does resize, and the size is right to surround the balloons, all the balloons are shifted down and to the right of where they should be, so some are outside of the rectangle.
I'm not understanding why the Top property of the balloons is being adjusted. It's almost like the controller rectangle is growing along its top and left edges (so up and left) rather than at the bottom.
- Attachments
-
- Yearly Planner Tests.livecode.zip
- (2.37 KiB) Downloaded 260 times
Re: Mouse & Group Interaction
Hi David,
I see Chris has made a stack for you.
I changed your stack a bit. What bit you is that Livecode changes size from the center. I.e. If you change the width of an object you also change the left and the right of an object.
Likewise if you change the height of an object you change the top and bottom at the same time. Lets say you increase the height by 20 then the top will be 10 less than before and the bottom 10 more than before.
You can prevent this if you get the top before changing the height for example and set the top to its old value after the change. Now your bottom will be + 20.
Kind regards
Bernd
I see Chris has made a stack for you.
I changed your stack a bit. What bit you is that Livecode changes size from the center. I.e. If you change the width of an object you also change the left and the right of an object.
Likewise if you change the height of an object you change the top and bottom at the same time. Lets say you increase the height by 20 then the top will be 10 less than before and the bottom 10 more than before.
You can prevent this if you get the top before changing the height for example and set the top to its old value after the change. Now your bottom will be + 20.
Kind regards
Bernd
- Attachments
-
- Yearly Planner Tests.0.2.livecode.zip
- (3.2 KiB) Downloaded 267 times
Re: Mouse & Group Interaction
bn wrote: What bit you is that Livecode changes size from the center. I.e. If you change the width of an object you also change the left and the right of an object.
Likewise if you change the height of an object you change the top and bottom at the same time. Lets say you increase the height by 20 then the top will be 10 less than before and the bottom 10 more than before.
You can prevent this if you get the top before changing the height for example and set the top to its old value after the change. Now your bottom will be + 20.

Ahah.
Thanks!
Re: Mouse & Group Interaction
David,
you might also want to download the revised version of your stack that I attached to my previous post.
Kind regards
Bernd
you might also want to download the revised version of your stack that I attached to my previous post.
Kind regards
Bernd