show menu

Alejandro Tejada capellan2000 at yahoo.com
Sun Feb 27 23:22:52 EST 2005


on Sun, 27 Feb 2005
Martin Blackman wrote:

> Dwayne
> You could have something like the following in a
card 
> or stack script.
[snip code]
> The button "Context" must be a popup menu button 
> and be sure to set its menumousebutton property 
> to 0 to prevent strange behaviour.  Put it 
> somewhere on the card and set its visible to false. 

Excellent example, Martin!!!  :-)

You will put the button in a group and reuse it
in every card where you need it.
The group needs a name (like "sharedResources")
and have set to true their "backgroundbehavior"
property. If you wish, hide the group or place
out of the visible screen locations.

-- Martin Blackman code, with button inside a group

on preopencard
if there is a button "Context" then
set the traversalon of btn "Context" to false
 -- prevents losing selection
else
place bg "sharedResources" onto this card
end if
end preopencard

on mouseDown theButton
if (theButton is 3) and (word 1 of the target =
"field") then
-- prepare the menu if desired, eg:
-- set the enabled of menuitem 2 of btn "Context" to
-- the cAcceptPaste of the target
popup button "Context"
-- you could popup a stack too, if you wish.
-- See the documentation about "popup"
end if
end mouseDown

I'm sure these additions could be rewritten
with more elegance, but you get the idea!

Keep up your good code!!!

al


=====
Visit my site:
http://www.geocities.com/capellan2000/


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail


More information about the Use-livecode mailing list