[REBOL] Re: is there a better way?
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
> 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
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