Yet another button question

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Srdjan
Posts: 26
Joined: Mon Aug 04, 2008 7:17 am

Yet another button question

Post by Srdjan » Wed Aug 27, 2008 12:27 pm

Hi there

I would like to handle all MouseEnter & MouseDown messages of card's buttons in one place. What I am trying to do is the following:

on mouseEnter
if button where mouseEnter event occured is "buton1" then...
end mouseEnter

is there function (or property) for that? I can't find it...

Regards

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Aug 27, 2008 12:40 pm

Hi Srdjan,

you can use "the target" (see the docs) like this in your cardscript (same for mousedown etc...):

Code: Select all

on mouseenter
  ## Only "react" on buttons:
  if word 1 of the target <> "button" then
    exit mouseenter
  end if
  
  ## Handle only THIS special button:
  if the short name of the target = "button1" then
    ## do your stuff...
  end if
end mouseenter
Hope that helps.


Best from germany

Klaus

Srdjan
Posts: 26
Joined: Mon Aug 04, 2008 7:17 am

Post by Srdjan » Wed Aug 27, 2008 1:02 pm

Ho, ho - it works!
Thank you very much for your help.

:D

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Aug 27, 2008 1:40 pm

Srdjan wrote:Ho, ho - it works!
Thank you very much for your help.

:D
ALL the code that I post here works, mortal disbeliever! :D

Post Reply