The Loose Item type
A loose item is an object which can be "indicated": When the pointer
appears over a loose item, a border is drawn around it (if the
item type is used, the behaviour is different when using
itemp). The item normally contains some text, although a routine
can be provided to draw an icon in it.
A loose item reacts to both HIT and DO events. If you
want you can also attach a keypress to it, which will be the same as a
HIT event. A loose item can have one of three statusses :
available, selected or unavailable. When an item
is unavailable, it can't be indicated (and thus will not get a border). A
HIT on the item will toggle between available and selected, and a
DO will select the item. Optionally, a user-defined function can
also be called on a HIT or DO event (but not when the
item is unavailable). The designer of the window can also choose that the
status of the item can never change, and that a DO event can be
propagated to the window.
The Type Word
When creating this type of object, the type parameter is:
PW('TYPE_LOOSE_ITEM')
The tags
Here are the tags for this object. As usual, change tags are also used when
creating the object, but query tags are only used for queries.
The change (and creation) tags
- PW('LOOSE_STATUS')
-
Set the current status of the loose item. The parameter can be either
PW('STATUS_AVAILABLE'), PW('STATUS_UNAVAILABLE') or
PW('STATUS_SELECTED')
. If the new status if different from the old,
then the item will be redrawn when control is handed back to ProWesS. By
default, the item status is set to PW('STATUS_AVAILABLE')
.
- PW('LOOSE_TEXT')
-
Set the text which should be displayed inside the loose item. The parameter
is a string. When AUTOSIZE is true, then the size of the loose item will be
redetermined when control is handed back to ProWesS. In other words, a
check is made to see whether the new text will fit in the item as is. If
not, the item will be made bigger so that the texts fits in it. In that
case, the whole window will be redrawn since the size of the item may have
changed.
- PW('LOOSE_TEXT_COPY')
-
Set the text which should be displayed inside the loose item. The parameter
is a string. The text is copied into a piece of memory which is allocated
(and released) by the loose items itself, so this can be a direct string.
When AUTOSIZE is true, then the size of the loose item will be redetermined
when control is handed back to ProWesS (see above).
- PW('LOOSE_CHANGE_STATUS')
-
The parameter is either 1(=TRUE) or 0 (=FALSE). By default, the value is
TRUE. The status of the loose item is only changed when change status is
TRUE. In this case a HIT will switch between
PW('STATUS_AVAILABLE')
and PW('STATUS_SELECTED')
. In the case of a DO, the
status will always be set to PW('STATUS_SELECTED')
. When the
loose item is unavailable (its status is set to
PW('STATUS_UNAVAILABLE')
), the status is not changed automatically
(actually, not even a border will be drawn around the item).
- PW('LOOSE_WINDOW_DO')
-
The parameter is either 1 (=TRUE) or 0 (=FALSE). By default it is FALSE.
When the window do status is TRUE, then the ENTER keypress is also handled
by the system (thus a keypress object can react to it).
- PW('LOOSE_CENTER_ITEM')
-
The parameter is either TRUE or FALSE. By default, the value is TRUE. If
the value is TRUE, then the text will be drawn in the centre of the loose
item, else it is drawn in the top left corner.
- PW('LOOSE_AUTOSIZE')
-
The parameter is either 1 (=TRUE) or 0 (=FALSE). By default, the value is
TRUE. When autosize is TRUE, then the size of the loose item will
automatically be redetermined when the text inside the item is changed. In
other words, ProWesS makes sure that the texts fits in the item. If
autosize is FALSE and no size is set explicitly, then the size of the text
in the time when the window is first activated is used.
- PW('LOOSE_ACTION_HIT')
-
Set the routine which should be called when the loose item reacts to a HIT.
The parameter should be an action routine, preferrably
HIT_ROUTINE
.
- PW('LOOSE_ACTION_DO')
-
Set the routine which should be called when the loose item reacts to a HIT.
The parameter should be an action routine, preferrably
DO_ROUTINE
. If no DO action exists for the loose item (or it is NULL), then
the HIT action routine will be called (if it exists) instead!
- PW('LOOSE_ACTION_DRAW')
-
Set a draw action for the loose item, the parameter should be an action
routine, preferrably
RDRW_ROUTINE
. The SubWindow is set to
cover the hit area of the loose item. The text will already be drawn. This
makes it possible (in combination with the tags to set the size) to draw
icons in loose items.
- PW('LOOSE_SIZE')
-
Set the minimum width and height of the loose item. The tag needs two
parameters, the x and y size, both in PROforma numbers. Setting the size
automatically also sets AUTOSIZE to FALSE.
- PW('LOOSE_XSIZE')
-
Set the minimum width of the loose item. The tag needs a PROforma number as
parameter. Setting the size automatically also sets AUTOSIZE to FALSE.
- PW('LOOSE_YSIZE')
-
Set the minimum height of the loose item. The tag needs a PROforma number
as parameter. Setting the size automatically also sets AUTOSIZE to FALSE.
- PW('LOOSE_KEYPRESS')
-
Attach a keypress to the loose_item. Hitting that key will be equivalent to
a HIT on the item. The parameter is the primary keypress, which is of type
CODE (character$)
.
- PW('LOOSE_AUTOREPEAT'). When this tag is passed, then HITting and DOing
on the item will autorepeat, i.e. keeping the mouse buttons, or ENTER &
SPACE pressed will repeatedly perform the action for this item.
The query tags
- PW('LOOSE_STATUS')
-
Get the current status of the loose item. The status can be either
PW('STATUS_AVAILABLE'), PW('STATUS_UNAVAILABLE')
or
PW('STATUS_SELECTED')
.
- PW('LOOSE_TEXT')
-
Get a pointer to the text which is displayed inside the loose item. This
text is read only ! Use MKSTRING$ to make that pointer into a normal SBasic
string. Normally, you wouldn't need this, if you keep the text in a
variable anyway.
PROGS, Professional & Graphical Software
last edited 1996 June 27 (wl)