How to assign values in popup menu item instead of choice 1 choice 2 in livecode -
how change choice 1, choice 2 ,choice 3 in popu menu special words (passing variables array). out using popup properties menu. means: contents of array svar[2] instead of choice 1 contents of array svar[3] instead of choice 2 .. on. each time value of choice 1, choice 2 differ. global searchstr global replacestr global ftext global myarraytobe global myarraylength global gvar on menupick pitemname put number of lines of (the keys of myarraytobe) myarraylength repeat i=1 myarraylength if myarraytobe[i] contains ftext put myarraytobe[i] svar answer svar split svar colon put svar[2] gvar answer gvar end if end repeat switch pitemname put gvar pitemname case gvar answer ftext break case "choice 2" answer "bye" break case "choice 3"answer "please" break end switch end menupick
hard see in question asking for, can set menu options using the text of button
if want change menu on fly when user clicks, can in on mousedown
handler:
on mousedown set text of me "one" & return & "two" & return & "three" end mousedown
if have global variable svar , populate menu when shown can also:
on mousedown global svar put svar tvar # copy array combine tvar return set text of me tvar end mousedown
if want change first 2 alternatives based on array svar
you can use:
put text of button "mymenubutton" ttext put svar[1] line 1 of ttext put svar[2] line 2 of ttext set text of button "mymenubutton" ttext
Comments
Post a Comment