Menu item with check mark and perform some task

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
kevin007
Posts: 40
Joined: Mon Sep 21, 2015 7:46 am

Menu item with check mark and perform some task

Post by kevin007 » Thu Oct 01, 2015 12:00 pm

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
--
Thanks
Kevin

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Menu item with check mark and perform some task

Post by dunbarx » Thu Oct 01, 2015 2:05 pm

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

Post Reply