News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
callback for an individual menu entry
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: callback for an individual menu entry

I haven't come to fully understand the menu classes, and haven't succeeded in setting a callback to a particular menu item. However, you can check for the menu item within the menu's callback and perform an action according to the result:

Code:
my_menu=fltk:Fl_Menu_Bar(0,0,200,30)
my_menu:add("File/Item 1")
my_menu:add("File/Item 2")
my_menu:add("File/Item 3")

my_menu:callback( -- a callback for the whole menu
function()
  if my_menu:text()=="Item 2" then
    print("this is Item 2")
  end
end
)

This post was last modified: 09-19-2007 01:34 AM by mikshaw.

09-19-2007 01:33 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
RE: callback for an individual menu entry - mikshaw - 09-19-2007 01:33 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: