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!
I am trying to create a menubar with multiple choices (ex: Blue, Black,Red). When selected, it changes the color of a button on the stack. What I was wondering... how can I create a "check mark" next to the menu item that was just selected?
on menuPick pItemName
switch pItemName
case "Black"
set the icon of button buttonFace to Blackicon.png
// NEED TO UNCHECK PREVIOUS SELECTION AND CHECK CURRENT SELECTION
break
case "Blue"
--code here
break
case "Red"
--- code
--code here
break
end switch
end menuPick
on menuPick pItemName
DoMyCheckMark the label of the target
switch pItemName
case "Black"
break
case "Blue"
--code here
break
end switch
set the label of the target to pItemName
end menuPick
on DoMyCheckMark pLabel
if pLabel = empty then exit DoMyCheckMark
put the text of the target into tPrevText
replace "!c" with empty in tPrevText
replace "!c" with empty in pItemName
put lineoffset(pLabel & cr, tPrevText & cr) into tMH
put "!c" before line tMH of tPrevText
set the text of the target to tPrevText
end DoMyCheckMark
Best regards
Jean-Marc
Last edited by jmburnod on Thu Jan 12, 2017 7:29 am, edited 1 time in total.
Here is an example of what is happening. (see attachment)
The menu selects the color correctly, however you have to select the menu two times before it puts a check mark next to the menu item.
I played a bit with your stack and I discover that The target of a btn of a menu group return the name of group and not the name of the clicked btn.
Here is a stack with menu and popup btn with same behavior.
They use the same script (in stack)
Jean-Marc