The check in a menu item
Terry Vogelaar
terry at discovery.nl
Sun Jan 27 01:24:01 EST 2002
>> In a menu I have 3 items that can be checked. When the check appears in the
>> 1st item, it should be removed from the 2nd and the 3rd item, and so on.
>>
>> But there is something about checking I don't understand. When I want a
>> menu-item to be checked, I put "!c" before the line of that item. But when I
>> want to move the check from that item to another, I get (or RR gets)
>> confused. If I just remove the "!c" from the first line and then add "!c" to
>> the second, I have 2 items checked instead of one. But when I remove replace
>> the "!c" with a "!n", the check is gone. Then I check a third item. Then
>> chaos begins. "!n" is visible in the 1st item. And the more I swap the
>> menus, the more "!n!n!n"s I see.
>>
>> With a lot of extra scripting, I managed to let it work reasonably reliable.
>> But I've got a feeling it should be less complex.
> What is the script you're using?
Never mind. I kinda figured out myself how to skip that useless "!n". For
all others who struggled with this problem, the final script is:
on menuPick pWhich
put whichNumbers() into lNumber
repeat with e = 1 to 3
if char 1 of line e of me = "!" then delete char 1 to 2 of line e of me
end repeat
switch pWhich
case "Hebrew numbers"
put 1 into lNumber
break
case "Traditional numbers"
put 2 into lNumber
break
case "English numbers"
put 3 into lNumber
break
end switch
put "!c" before line lNumber of me
end menuPick
function whichNumbers
repeat with e = 1 to 3
if char 1 to 2 of line e of btn id 1008 = "!c" then return e
end repeat
end whichNumbers
Groetjes,
Terry
More information about the use-livecode
mailing list