Page 1 of 1

Menu item with check mark and perform some task

Posted: Thu Oct 01, 2015 12:00 pm
by kevin007
Hi,

I am a beginner in Livecode, I have created Menu bar using menu builder, My problem is when I click the menu item a check mark should appear along with the menu item and perform some task, During the second click the menu item should appear without check mark for that I am using the following code, but while using this code along with menu item I got "!c" text. How I solve this Problems :(

Code: Select all

put "!c" before line 2 of button "File"
Thanks
Kevin

Re: Menu item with check mark and perform some task

Posted: Thu Oct 01, 2015 2:05 pm
by dunbarx
Hi.

You want to toggle the checkMark, alternating having it and not having it after each invocation of the menu?

If so, the menuItems in a menu are merely the contents of the button that provides that menu, similar to a pull-down or pop-up. So you can test the text of line 2 of the button, and if it contains "!c" then delete the first two chars of that line. Or add them, in the alternate case. You might do this in a mouseDown:

Code: Select all

on mouseDown
   if "!c" is not in line 2 of me then put "!c" before line 2 of me else delete char 1 to 2 of line 2 of me
end mouseDown
Craig Newman