help with "click at the loc of card button"

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

help with "click at the loc of card button"

Post by FireWorx » Thu Sep 22, 2011 9:01 pm

I searched the forum first sure to find an answer but no so here is my question.

I would like to use the "click at the loc of card button" script in a locked field directly over the cool button. to provide a cool label and deliver the click but because the field sits over the button it causes a repeat of button clicks on itself. 400,000 to be exact.

Any ideas? There is probably something super easy but this has me stumped for the last couple hours.

Dave

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: help with "click at the loc of card button"

Post by mwieder » Thu Sep 22, 2011 9:08 pm

Dave- not sure what you're trying to accomplish here. Lemme see if I've got this straight - you've got a locked field and a button hidden behind the field? Then you want to catch the mouseUp event in the field and have it click the button?

If that's the case, why not place a transparent button over the field and just use a mouseUp handler in the button? OTOH, if you need to pass a mouseUp event to the button for some other reason, a simple "send 'mouseUp' to button xyzzy" should do it.

Or I may have completely misunderstood what you're trying to do. Wouldn't be the first time.

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: help with "click at the loc of card button"

Post by FireWorx » Thu Sep 22, 2011 10:20 pm

Hi,
The situation is I have some cool radio style buttons in a group. The button looks funny when I try and center the text label of the button on highlight. I would like to have some nice looking text in a locked field float over the button and act as a label for that button. The fields location directly over the button prevents a mouse click on the button itself. Although sending a mouse up handler to the button would activate the script it doesn't change the highlight like a click does. I could also set the highlight but then I would have to deselect all the rest of the highlights of the rest of the buttons in the group and write a complex script for each one. I figure there is some easy way to do it.

Sending a "click at loc of card button" works great from the message box etc, and every location other than above the button. I know there is a simple way to do this. Not sure what it is though. Perhaps hiding the field, execute the click, then re show the
field but thought there might be a way to disable he field for a few millisecs deliver the click and then enable the field again. or pass messages for a few millisecs or something. People do this all the time so has to be away.
Dave

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: help with "click at the loc of card button"

Post by sturgis » Fri Sep 23, 2011 12:49 am

Think I see what you mean.

I just created a button, set it to not show name, placed a nicely formated/aligned label over the top of it.

In the label/field script I just put this.

Code: Select all

on mouseDown
   set the hilited of button 1 to true -- hilite the button when the mouse is down. 
end mouseDown

on mouseUp
   set the hilited of button 1 to false -- remove hilite
   send "mouseUp" to button 1 -- send a mouseUp to the button so it actually executes. 
end mouseUp
It works sorta, but there are issues to be worked around, such as if you click, then move your mouse off the field and release the mouse, the button stays hilited. I'm sure there are other issues to discover also, but this is basically what you speak of correct? If so, maybe someone else can flesh it out a bit i'm too short of time right this sec to do so.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: help with "click at the loc of card button"

Post by mwieder » Fri Sep 23, 2011 1:01 am

Wouldn't layering the field *behind* the radio button do the trick?

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: help with "click at the loc of card button"

Post by sturgis » Fri Sep 23, 2011 1:17 am

mwieder wrote:Wouldn't layering the field *behind* the radio button do the trick?
OH duh. Yeah. Set button to opaque, put label behind it and viola'.

Do it that way dave! (goes to hide in the "makes things too difficult" corner)

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: help with "click at the loc of card button"

Post by FireWorx » Fri Sep 23, 2011 4:09 am

Are you trying to be funny? Setting the button to opaque and layering the field behind the button? Why would I need the field at all? Crazy talk.

The issue is I have a group of 5 radio style buttons that look like dash light flip switches. I want to label the flip switches but if you choose the centered font it messes up the button. If you use the align right and set the margin to center the text it makes the button so wide that it overlaps the other button and looks funky when it highlights especially in IOS mode. I know there is a slick way to do this and someone will come up with one. If nothing else the buttons are pretty tall. I can make the label narrower than the button and send the click at to a spot lower than the field but still on the button in the event the user clicks directly on the field.

Dave

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: help with "click at the loc of card button"

Post by sturgis » Fri Sep 23, 2011 5:38 am

No, set the button to non-opaque so the label will show through from behind. So that any clicks (even programmatic) go to the button. I mistyped the first time, set button to NOT opaque and it works a treat.

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: help with "click at the loc of card button"

Post by FireWorx » Fri Sep 23, 2011 5:27 pm

I will try it and let you know but based on the fact that I toggle between two images selected for the highlight and non highlight of the button I doubt setting the button to see through will work. I want the users to see the button graphic. That is the whole point. Think Ill just get the rect of the field and add 10 pixels to that dimension and then send the mouse click to that location. That should hit on the button just south of the field. Thanks for your input however. I do appreciate it.
Dave

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: help with "click at the loc of card button"

Post by mwieder » Fri Sep 23, 2011 7:26 pm

Dave- you're making this much more complicated than it needs to be. Here's a sample stack with three radio buttons with custom icons and three associated fields. The trick is to size the radio buttons down to just the size of the icon itself. Then you can do whatever you want with the field formatting.
Attachments
radios.livecode.zip
test file
(719 Bytes) Downloaded 262 times

Post Reply