[REBOL] Re: How do I create menus in View
From: allenk:powerup:au at: 9-Jan-2001 23:20
Hi Ganjan,
Welcome to the list.
REBOL/View does have menus, but they may not have the look and feel or
operation that you are after, if you are trying to get the feel of an OS.
And implementation of submenus is not something that I would not suggest for
a beginner, (give it a week or two ;-)
The magic function to look at is CHOOSE.
? choose
USAGE:
CHOOSE choices function /style styl /window winf /offset xy /across
DESCRIPTION:
Generates a choice selector menu, vertical or horizontal.
CHOOSE is a function value.
ARGUMENTS:
choices -- Block of items to display (Type: block)
function -- Function to call on selection (Type: function none)
REFINEMENTS:
/style
styl -- The style choice button (Type: object)
/window
winf -- The parent window to appear in (Type: object)
/offset
xy -- Offset of choice box (Type: pair)
/across -- Use horizontal layout
Here's a little example
; start example
; makes dealing with pairs easier
as-pair: func [xy [block!]][
to-pair reduce xy
]
choices: func [f [object!]][
choose/offset/window ["Time" "Save" "Quit" "Cancel"]
func [fa e][
switch/default fa/text [
"Time" [hide-popup request/ok form now]
"Save" [hide-popup request/confirm "Save?"]
"Quit" [Quit]
][
hide-popup
]
]
; set the offset to draw at and the parent-face
as-pair [f/offset/x f/offset/y + f/size/y] f/parent-face
]
view layout [size 200x200 text "menu" white 40.100.130 center bold [choices
face]]
; end example
Hope this helps,
Allen K
----- Original Message -----
From: "Gunjan Karun" <[gunjan_karun--yahoo--com]>
To: <[rebol-list--rebol--com]>
Sent: Tuesday, January 09, 2001 1:05 AM
Subject: [REBOL] How do I create menus in View
> Hi Gurus,
> I am a kid wrt rebol and am trying out the possibility of using it in our
organization.
> Right now I'm exploring the REBOL/View (0.10.38.3.1)
> I have two problems,
> Firstly - Does REBOL/View have the concept of menus (and menu items), if
yes, can anyone kindly give me some pointers where I might explore.
> Secondly - Now that I have installed the REBOL/View on my m/c everytime I
do about on its console, it shows me the version of the View and not of the
core. Is there any way I can find out the version of the REBOL Core on my
machine.