Page 1 of 1

text over button prevents button from working |SOLVED|

Posted: Fri Jul 04, 2014 4:01 pm
by Johan_VH
Hi all,

I made a button out of custom icons, basically a simple white square, and as down-state a grey square. On top of that button I have place 2 labels. One big one that covers 2 thirds of the button, one small one underneath that. I then grouped these 3 objects. When I test it however, the button only responds to my mouse when the mouse is over a part of the button that has no text on top of it.

So my problem is, the whole group should act as the button. I cannot seem to find how to prevent LiveCode from giving focus to the labels. I could of course just make different images in photoshop, but later on I will have to make an onscreen keyboard too, which should change the available characters according to the selected language, so I would really like to be able to create my buttons like this...

Any help is, as always, greatly appreciated!

Johan

Re: text over button prevents button from working

Posted: Fri Jul 04, 2014 4:18 pm
by bangkok
-edit your group
-"send back" your label (via properties size&position)
-set your button/icon to not opaque

Re: text over button prevents button from working

Posted: Fri Jul 04, 2014 4:20 pm
by Klaus
Hallo Johan,
Johan_VH wrote:...When I test it however, the button only responds to my mouse when the mouse is over a part of the button that has no text on top of it.
yep, that is intended behavior.
Johan_VH wrote:I made a button out of custom icons, basically a simple white square, and as down-state a grey square.
Is this a BUTTON object you are using for this and you set its HILITE-ICON?
Johan_VH wrote:So my problem is, the whole group should act as the button.
The trick for "custom controls" (which are groups in fact) is to script the GROUP to do what you want.
So instead of setting the HILITE icon of the one button you do all thsi stuff by script, something like this in the group script:

Code: Select all

on mousedown
  set the icon of btn "your button name here" of me to 1006
  ## Replace 1006 with the ID of the image YOU are using!
  ## Same for MOUSEUP below
end mousedown

on mouseup
  set the icon of btn "your button name here" of me to 1005
  ## See above :-)
  ## Do your stuff here...
end mouseup

on mouserelease
  set the icon of btn "your button name here" of me to 1005
end mouserelease
You get the picture :D


Best

Klaus

Re: text over button prevents button from working

Posted: Fri Jul 04, 2014 4:32 pm
by Johan_VH
Hi,

I just wanted to come here to say I figured it out myself by changing the icon from a script, but you beat me to it. :D

thanks!

Johan