Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

is there a better way?

 [1/3] from: rishioswal:y:ahoo at: 5-May-2001 13:06


wondering if there is a better way to do the following lines of code (rather than using so many if statements) menu-choice: choice 150 "Menu1" "Menu2" "Menu3" [ if ((first value) = "Menu1") [menu-panel/pane: menu1 show menu-panel] if ((first value) = "Menu2") [menu-panel/pane: menu2 show menu-panel] if ((first value) = "Menu3") [menu-panel/pane: menu3 show menu-panel] ] i tried this... menu-choice 150 "Menu1" "Menu2" "Menu3" [ [menu-panel/pane: to-word first value show menu-panel] ] i also tried variations of this menu-choice 150 "Menu1" "Menu2" "Menu3" [ [set 'menu-panel/pane to-lit-word first value show menu-panel] ] but nothing elegant seems to work... rishi

 [2/3] from: gjones05:mail:orion at: 5-May-2001 15:35


From: "Rishi Oswal"
> wondering if there is a better way to do the following > lines of code (rather than using so many if
<<quoted lines omitted: 19>>
> but nothing elegant seems to work... > rishi
Hi, Rishi, Depending on what you want, the following may work for you: view layout [ menu-panel: text 50x20 menu-choice: choice 150 "Menu1" "Menu2" "Menu3" [ menu-panel/text: menu-choice/text show menu-panel ] ] --Scott Jones

 [3/3] from: ingo:2b1 at: 5-May-2001 22:02


Hi Rishi, Once upon a time Rishi Oswal spoketh thus:
> wondering if there is a better way to do the following > lines of code (rather than using so many if
<<quoted lines omitted: 7>>
> [menu-panel/pane: menu3 show menu-panel] > ]
You could use switch instead: switch first value [ "Menu1" [menu-panel/pane: menu1 show menu-panel] "Menu2" [menu-panel/pane: menu2 show menu-panel] "Menu3" [menu-panel/pane: menu3 show menu-panel] ]
> menu-choice 150 "Menu1" "Menu2" "Menu3" [ > [menu-panel/pane: to-word first value > show menu-panel] > ]
The problem is, you set the pane _to the word_ menuX, but really want to set it to the value this word is pointing to: menu-choice 150 "Menu1" "Menu2" "Menu3" [ [menu-panel/pane: get to-word first value ; === get the value show menu-panel] ] I'm not sure, but maybe the following works, too: menu-choice 150 "Menu1" "Menu2" "Menu3" [ [menu-panel/pane: to-get-word first value ; =========== get the value show menu-panel] ] I hope that helps, Ingo

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted