
A text field over a button prevents mouse messages...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
A text field over a button prevents mouse messages...
... to reach the button, right? 

Re: A text field over a button prevents mouse messages...
Yep
Simon
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: A text field over a button prevents mouse messages...
Thank you Simon, and unfortunately, turn the field disabled to let mouse messages to pass, makes the text to become grayout... 

Re: A text field over a button prevents mouse messages...
Ok my turn to try my psychic abilities.
I'd group them and put the mouseUp into the grp script.
Simon
I'd group them and put the mouseUp into the grp script.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: A text field over a button prevents mouse messages...
Thank you, exam passed. 

Re: A text field over a button prevents mouse messages...
This harkens to a thread on this forum just a couple of weeks ago, The idea Simon had of grouping the two controls, and putting a mouseUp handler in the group so that the action would appear to come from the underlying button is clever. But it has issues in that only one button can be taken as the target within that group unless clickLoc stuff is managed as well.
I was involved with that thread, and so am writing to say why not just set the behavior of the field to the underlying button? Of course, this will only work in a locked field, unless other shenanigans, like using "mouseDown" are used. Always gratified that LC offers a way, if only I am patient. And sometimes lucky.
Craig Newman
I was involved with that thread, and so am writing to say why not just set the behavior of the field to the underlying button? Of course, this will only work in a locked field, unless other shenanigans, like using "mouseDown" are used. Always gratified that LC offers a way, if only I am patient. And sometimes lucky.
Craig Newman
Re: A text field over a button prevents mouse messages...
Thank you Craig, very interesting considerations.
I found also another way to add to our list of ways: set the text field disabled property true and its foregroundColor property to black.
I found also another way to add to our list of ways: set the text field disabled property true and its foregroundColor property to black.
Re: A text field over a button prevents mouse messages...
Mag.
Just so. And though a kluge of sorts, is simpler than mine.
Good ol' LC.
Craig
Just so. And though a kluge of sorts, is simpler than mine.
Good ol' LC.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: A text field over a button prevents mouse messages...
Why not just disable the button? Wouldn't it be confusing to the user to have a button that appears enabled but doesn't respond to clicks?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: A text field over a button prevents mouse messages...
Richard.
The button is covered by a text field, which displays text.
The idea was similar to one I mentioned a little while back, that it might be useful to have a property of a control that made it "transparent" to mouseClicks. So if the overlying field had this property, the click would "pass" through to an underlying control.
The several solutions in this thread all are workarounds to this "missing" property.
Craig
The button is covered by a text field, which displays text.
The idea was similar to one I mentioned a little while back, that it might be useful to have a property of a control that made it "transparent" to mouseClicks. So if the overlying field had this property, the click would "pass" through to an underlying control.
The several solutions in this thread all are workarounds to this "missing" property.
Craig
Re: A text field over a button prevents mouse messages...
I post here an example of the button where the text field is used like a label for the button (and set to disabled and with a foregroundColor assigned to it).
- Attachments
-
- FieldOverAButton.livecode.zip
- (6.71 KiB) Downloaded 168 times
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: A text field over a button prevents mouse messages...
Thanks, Mag. Very helpful to see what you're building.
It seem the desire to use an overlay field is a workaround for the vertical alignment issue when setting the button's icon to the background image. But if you set the icon back to 0 and set the button's backgroundPattern to the id of the image, I think you'll have what you're looking for in a single object. Note that you'll also need to set the opaque of the button to true; it's currently set to false.
Alternatively, if you truly needed a compound custom object you could group the button and field together and set the behavior on the resulting group, which would trap events regardless of which control within the group got the message.
But if your result looks as good as my quick tweak of the button here, I think you'll find that just setting the button's backgroundPattern will do what you're looking for.
It seem the desire to use an overlay field is a workaround for the vertical alignment issue when setting the button's icon to the background image. But if you set the icon back to 0 and set the button's backgroundPattern to the id of the image, I think you'll have what you're looking for in a single object. Note that you'll also need to set the opaque of the button to true; it's currently set to false.
Alternatively, if you truly needed a compound custom object you could group the button and field together and set the behavior on the resulting group, which would trap events regardless of which control within the group got the message.
But if your result looks as good as my quick tweak of the button here, I think you'll find that just setting the button's backgroundPattern will do what you're looking for.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: A text field over a button prevents mouse messages...
Yes, you're right, that was the reason why I used the text field. I tried what you suggested (simple and straightforward) and it works fine. Thank you!
PS
I post here the new version.
PS
I post here the new version.
- Attachments
-
- FieldOverAButton2.livecode.zip
- (6.71 KiB) Downloaded 170 times