Check Menu Items?

Ken Ray kray at sonsothunder.com
Sun Apr 21 12:29:00 EDT 2002


Rick,

> The !c checkmarks the menuitem, but I need to have this
> done dynamically depending on which item the user selects.
> The checkmark doesn't go on and off accordingly.  Have I
> missed something?  Where in the documentation did you find
> this little nugget?


You need to do this manually by removing the !c when the menu item is
selected, and then putting it back in when it is selected again.

Here's an example:

on menuPick
  put the menuHistory of me into tSelection
  put me into tMenuItems
  if char 1 to 2 of line tSelection of tMenuItems = "!c" then
    delete char 1 to 2 of line tSelection of tMenuItems
  else
    put "!c" before line tSelection of tMenuItems
  end if
  put tMenuItems into me
end menuPick

This toggles the checkmark for a menu item in a popup menu button.

BTW: You can find this in the Revolution Documentation - click on the
"RoadMap" button, then click "Development Guide", then "Menus", then "menus
and the menu bar" (under the About section). Scroll down about half way to
"Special Effects In Menus".

Easy! ;-)

Hope this helps,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/




More information about the use-livecode mailing list