| Version 1.9 Build 1556
|
|
Next: extendoptionmenu.extend - Function
Up: extendoptionmenu - Tool
Previous: extendoptionmenu - Tool
extendoptionmenu - Constructor
|
Package |
display |
|
Module |
widgets |
|
Tool |
extendoptionmenu |
Construct an extendoptionmenu
Synopsis
extendoptionmenu(parent, labels, hlp, hlp2, nbreak, symbol, callback1, callback2, callbackdata, dialoglabel, dialogtitle, padx, pady, width, updatelabel, height, justify, font, relief, borderwidth, foreground, background, disabled, anchor, fill, widgetset)
Arguments
parent |
|
Parent of the menu |
|
|
Allowed: |
Widget |
labels |
|
The menu item labels |
|
|
Allowed: |
Vector of strings |
|
|
Default: |
Empty menu |
hlp |
|
Short popuphelp text |
|
|
Allowed: |
String |
|
|
Default: |
No help |
hlp2 |
|
Long popuphelp text |
|
|
Allowed: |
String |
|
|
Default: |
No help |
nbreak |
|
The break point for menu or listbox usage |
|
|
Allowed: |
Integer |
|
|
Default: |
20 |
symbol |
|
Special symbol for menu extension |
|
|
Allowed: |
String |
|
|
Default: |
`...' |
callback1 |
|
Callback function when special symbol selected |
|
|
Allowed: |
String |
|
|
Default: |
F |
callback2 |
|
Callback function when special symbol selected |
|
|
Allowed: |
String |
|
|
Default: |
F |
callbackdata |
|
Data for callback2 calculations |
|
|
Allowed: |
Any Glish variable |
|
|
Default: |
F |
dialoglabel |
|
Label for dialogbox |
|
|
Allowed: |
String |
|
|
Default: |
`Item' |
dialogtitle |
|
Title for dialogbox |
|
|
Allowed: |
String |
|
|
Default: |
`Enter new item <CR>' |
padx |
|
Horizontal padding around text |
|
|
Allowed: |
Integer |
|
|
Default: |
7 |
pady |
|
Vertical padding around text |
|
|
Allowed: |
Integer |
|
|
Default: |
3 |
width |
|
Width in character units |
|
|
Allowed: |
Integer |
|
|
Default: |
Auto-scale |
updatelabel |
|
Update menu label with selected item |
|
|
Allowed: |
T or F |
|
|
Default: |
T |
height |
|
Height in character units |
|
|
Allowed: |
Integer |
|
|
Default: |
1 |
justify |
|
Justification of text |
|
|
Allowed: |
String from `center', 'left', 'right' |
|
|
Default: |
`center' |
font |
|
Font of text |
|
|
Allowed: |
X font |
relief |
|
Edge relief |
|
|
Allowed: |
String from `flat', `ridge',
`raised', `sunken', `groove' |
|
|
Default: |
`groove' |
borderwidth |
|
Border width |
|
|
Allowed: |
Integer |
|
|
Default: |
2 |
foreground |
|
Color of text |
|
|
Allowed: |
X color |
|
|
Default: |
`black' |
background |
|
Background color |
|
|
Allowed: |
X color |
|
|
Default: |
`lightgrey' |
disabled |
|
Is inactivated ? |
|
|
Allowed: |
Boolean |
|
|
Default: |
F |
anchor |
|
Location of text |
|
|
Allowed: |
String from 'c', 'n', 's', 'e', 'w', 'ne',
'nw', 'se', 'sw' |
|
|
Default: |
`c' |
fill |
|
How to expand when resized |
|
|
Allowed: |
String from `x', `y', `both', `none' |
|
|
Default: |
'none' |
widgetset |
|
The widget server to use |
|
|
Allowed: |
widgetserver tool |
|
|
Default: |
dws |
Returns
Agent
Description
By default, the extendoptionmenu will insert a ``...'' into the
menu (you don't include it in the labels list). Use the argument
symbol) to use a different special selection symbol. When the user selects this
item from the menu, a few things might happen.
First, if callback1 is a valid function, then it is invoked (it has no arguments),
and the result is expected to be a string which is inserted into the menu
(duplicates are ignored).
Second, if callback1 is not a valid function, then a
ahlinkdialogboxwidgets:dialogbox widget is created, and the user
types the new menu item label into the entry box of this widget. If the
new item is a duplicate, nothing further happens. Otherwise, if callback2 is a valid function, then it is invoked with arguments callback2(newitem, labels, callbackdata. Here, newitem is the
string that came from the dialogbox. labels is the list of
current menu labels, and callbackdata is any Glish variable you
care to pass into the callback2 function. It is up to you, the
programmer, whether you need to use callbackdata or not. If the
result returned from callback2 is T, then the newitem
is placed in the menu.
Note that the width argument can be used in three ways.
If width=-1 (the default), the menu button will be wide enough
(and of fixed width) to accomodate all of the item labels in the menu.
This means that the GUI won't jitter when you write different
length labels into it. If width=0, then the menu button
will change its width to accomodate whatever label is written
into it. If width > 0, then the button is again of fixed
width, with the width that you specify.
If there are less items in the list than nbreak, you will see a
flat menu. Otherwise, you will see a scrolling list box. Note that
to activate the listbox you must press and release the main button.
Whereas for the flatmenu, pressing is enough to activate it.
Example
- include 'extendoptionmenu.g'
- labels := "m cm mm";
- f := frame();
- em := extendoptionmenu(f, labels);
The ellipsis is used, by default, as the menu extend symbol. A dialog
box will appear if the user selects the extend symbol. If the user
types in a string which is not already in the list of labels, it will be
added to the menu.
Example
- include 'quanta.g'
- include 'extendoptionmenu.g'
- qs := quanta();
- labels := "m cm mm";
- f := frame();
- em := extendoptionmenu(f, labels, callback2=myfun, callbackdata=qs)
The ellipsis is used, by default, as the menu extend symbol. A dialog
box will appear if the user selects the extend symbol. If the user
types in a string which is not already in the list of labels, it will be
added to the menu provided the function myfun, which you supply,
returns T. Function tt myfun is given the quanta server tool, qs
for use.
Next: extendoptionmenu.extend - Function
Up: extendoptionmenu - Tool
Previous: extendoptionmenu - Tool
 
Contents
 
Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc.,
Washington, D.C.
Return to AIPS++ Home Page
2006-10-15