|
Contents | Previous | Next | Subchapters |
| See Also | radiobuttons |
addcontrol(caption, geometry, "popupmenu", menu, index)
addcontrol(caption, geometry, "popupmenu", menu, index, call back)
Adds a "popupmenu" control,
with the specified
geometry
,
to the window specified by
caption
.
The geometry specifies the size of the menu when it is popped up.
The character matrix menu specifies the choices in the
popup menu.
The integer scalar index specifies which row of menu
is used for the initial setting
of the popup menu
(it must be between 1 and the row dimension of menu).
The command specified by
call back
is executed whenever the contents of the popup menu is changed
by the user.
The return value is the
control handle
for the popup menu.
getcontrol(handle)
Returns the current section in the "popupmenu" control specified by
handle, where
handle is the value returned by addcontrol
when the "popupmenu" control was created.
The return value is a character row vector.
setcontrol(handle, menu)
Changes the list of choices in the "popupmenu" control specified by
handle to the list specified menu, where
handle is value returned by addcontrol
when the "popupmenu" control was created and menu is
a character matrix.
The return value of setcontrol is true, if the
control can be set as requested, and false otherwise.
clear
#
Caption = "Test Dialog"
geometry = [100, 100, 200, 100]
callback = "delwin(Caption);"
adddialog(Caption, geometry, callback);
#
geometry = [20, 20, 70, 100]
menu = {"One", "Two", "Three"}
index = 2
Handle = addcontrol(Caption, geometry, "popupmenu", menu, index)
#
geometry = [70, 50, 50, 20]
name = "Done"
callback = "Done"
addcontrol(Caption, geometry, "pushbutton", name, callback);
#
count = 0
function Done() begin
global count, Handle, Caption
count = count + 1
if count == 1 then begin
menu = {"A 1", "B 2", "C 3", "D 4"}
setcontrol(Handle, menu);
return
end
print getcontrol(Handle)
delwin(Caption);
end