two msgs in a lock field
Jeanne A. E. DeVoto
jeanne at runrev.com
Fri Jan 3 16:18:01 EST 2003
At 9:21 AM -0800 1/3/03, Yves Coppé wrote:
>I have a scroll list filed with lockText to true
>Working on Mac OS X and 9
>
>when the user click a line, the handler execute something
>when the user hold the mousestilldown another handler is executed.
>
>Now how can I prevent the mouseUp handler to be executed if the
>mousestilldown is sent.
Here's a recipe (from the Cookbook) to do this (this example changes the
text color, but you can do whatever you want instead):
local didPopUpMenu -- keeps track of whether the menu was popped up
on mouseDown
put false into didPopUpMenu -- start out by assuming no menu
send "popGoesTheMenu" to me in 2 seconds
end mouseDown
on popGoesTheMenu theLocation
-- The menu will pop up only if the user is still pressing
-- the mouse over the button after 2 seconds:
if the mouse is up \
or the mouseLoc is not within the rect of me \
then exit popGoesTheMenu
put true into didPopUpMenu -- skip the mouseUp actions
popup button "Colors" -- the hidden popup menu
end popGoesTheMenu
on mouseUp
-- if the user popped up the menu, don't do the click action
if didPopUpMenu then pass mouseUp
-- if there is a text selection, set its color:
if the short name of the selectedField is "Example Text" then
set the textColor of the selectedChunk \
to (last word of the label of me)
end if
end mouseUp
--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - The Solution for Software Development
http://www.runrev.com/
More information about the use-livecode
mailing list