The Choice Display Class

The choice class, like the radio class, is for boolean-valued slotfiller variables where one and only one of the values is 1. The value area and the button are one. The value area always holds the symbolic index of the only slotfiller value that is equal to 1. The items in the pulldown menu are called the label areas.

In effect, the choice display class is a one-item cascade menu with one submenu. The items of the submenu are the symbolic indices of the slotfiller. The menu is navigated and an item is selected in any one of the ways defined for the menu display classes; see "Selection using the Left Mouse Button", and "Selection and Traversal using the Tab, Arrow and Page Keys". Selecting an item in the submenu amounts to selecting a symbolic index of the slotfiller. When an item is selected, if the value at that symbolic index is 0, then it becomes 1 and the value that was 1 becomes 0. In addition, the submenu disappears and the selected symbolic index - the choice of the selection - is displayed in the value area.

Selecting an item causes a value change in the underlying variable. Therefore, if a callback function is defined for the variable, it is called whenever a new item is selected; the path argument p is the symbolic index to the changed value. Note that even though there are two value changes, any callback function associated with the underlying global variable is called only once, and the path argument of the callback function refers to the value that changed from 0 to 1. If an item in the submenu that already has the value 1 is selected, no callback occurs.

The label areas of an object in the choice display class correspond to the items in the pulldown submenu. They cannot be edited. The text in the value area also cannot be edited.

Visual Representation
  ch(`Name`Account`Date`Security`Amount;(1;0;0;0;0))
  `ch is `choice
  `ch has (`shelltitle;'ShellTitle'; `title;'Sort by:')
  show `ch

The second figure shows the appearance and position of the drop down menu after the user has pressed the left mouse button with the pointer anywhere on the choice button (not just the raised rectangle). It would look the same except that the yellow outline would not appear if Enter had been pressed with the pointer anywhere on the widget.

For information about a widget element, click the left mouse button with the tip of the pointer index finger on it. Point inside the frame but outside the widget for attributes governing overall size, position, etc.

The element you are pointing at is named in the status message area at the bottom of the window.

(Clicking the middle mouse button instead displays this information in a new browser.)



Attributes

See the "Display Attributes" chapter for details concerning all the attributes that apply to objects in the choice display class, as well as lists of colors and fonts. The keys in the Table of All Display Attributes that pertain to this class are E, ALL, CNFT, NFT, and TOP.

The attributes that are meaningful for the choice display class (other than the print... attributes) are:

acceptfocus
active
ancestors
arrowdown
arrowkeys
arrowleft
arrowlist
arrowright
arrowup
at
atsector
b
bg
bound
class
clear
cols
deiconized
doc
downto
dynamic
eval
evaluate
exit
extent
f1-f12
fg
fkeys
focus
followers
followertree
font
foot
freeze
fullscreen
h
H
has
head
hide
hl
hlthickness
icon
iconic
iconized
icontitle
incurrentworkspace
is
l
label
labelfg
labelfont
leader
leftto
literal
lower
mapped
naturalsize
notify
outofcurrentworkspace
parent
pin
preset
primary
protect
protected
r
raise
realize
refresh
request
resize
resizeable
rightto
script
sensitive
set
settings
shadowthickness
shell
shelltitle
show
state
stateself
syncshow
t
tabfrom
tablist
tabto
upto
title
titlefg
titlefont
titlejustify
vcol
vcols
verify
vrow
vrows
w
W
ws
x
X
xs
y
Y
ys
yx
YX
yxs
(Point the mouse cursor to an attribute to display a short description at the bottom of the screen)


doc@aplusdev.org© Copyright 1995–2008 Morgan Stanley Dean Witter & Co. All rights reserved.