Applications can get the event handler routine for a panel item with the following call:
Panel_item item;
event_proc = (void (*)())xv_get(item, PANEL_EVENT_PROC);
You may not assume that the default event handler for any panel item is panel_de-
fault_handle_event(), as in previous XView versions. You must xv_get() the
item’s PANEL_EVENT_PROC. The event handler has the following parameters:
void
panel_item_event_proc(item, event)
Panel_item item;
Event *event;
7.19.8 Event Handling Example
The program item_move.c (a longer program listed in Appendix F, Example Programs) dem-
onstrates how events can be handled in panels. The program allows you to create, destroy,
and move around three different types of panel items. Two panels are displayed (see Figure
7-22) The control panel contains two panel items: a text item to type in panel item names and
a choice item providing the different item types that may be created. The destination panel is
where newly created panel items are placed. It is boxed. After items are created, you may
move them around the destination panel using the MENU mouse button. Moving the item off
the destination panel deletes the item.
Figure 7-22. Output of item_move.c in use
The code for item_move.c uses the interpose function, notify_inter-
pose_event_func(), to handle events within the destination panel. This interferes with
the normal event processing for the destination panel; however, events continue to be
dispatched to the panel items through the use of the notify_next_event_func().
Since the event function is only interested in MENU button events that occur on the destina-
tion panel’s panel items, it might seem appropriate to use PANEL_EVENT_PROC since it is
designed to notify the routine only when panel items receive events. However, this method
would not work for this application because when the mouse button is dragged around the
208 XView Programming Manual
frame to move the item, the dragging events might move outside of the button and when that
occurred the event callback would not be called.
7.20 Panel Package Summary
Table 7-4 lists the procedures and macros for the PANEL package. Table 7-5 lists the attri-
butes for the PANEL package. This information is fully described in the XView Reference
Manual.
Table 7-4. Panel Procedures and Macros
Procedures and Macros
panel_advance_caret() PANEL_CHECK_BOX
panel_backup_caret() PANEL_CHOICE_STACK
panel_paint() PANEL_EACH_ITEM()
panel_text_notify() PANEL_END_EACH()
PANEL_TOGGLE
Table 7-5. Panel Package Attributes
Panel Attributes
PANEL_ACCEPT_KEYSTROKE PANEL_LAYOUT
PANEL_BACKGROUND_PROC PANEL_LINE_BREAK_ACTION
PANEL_BUSY PANEL_LIST_CLIENT_DATA
PANEL_CARET_ITEM PANEL_LIST_CLIENT_DATAS
PANEL_CHILD_CARET_ITEM PANEL_LIST_DELETE
PANEL_CHOICE_COLOR PANEL_LIST_DELETE_ROWS
PANEL_CHOICE_IMAGE PANEL_LIST_DELETE_SELECTED_ROWS
PANEL_CHOICE_IMAGES PANEL_LIST_DISPLAY_ROWS
PANEL_CHOICE_NCOLS PANEL_LIST_FIRST_SELECTED
PANEL_CHOICE_NROWS PANEL_LIST_FONT
PANEL_CHOICE_RECT PANEL_LIST_FONTS
PANEL_CHOICE_STRING PANEL_LIST_GLYPH
PANEL_CHOICE_STRINGS PANEL_LIST_GLYPHS
PANEL_CHOOSE_NONE PANEL_LIST_INSERT
PANEL_CHOOSE_ONE PANEL_LIST_INSERT_DUPLICATE
PANEL_CLIENT_DATA PANEL_LIST_INSERT_GLYPHS
PANEL_CURRENT_ITEM PANEL_LIST_INSERT_STRINGS
PANEL_DEFAULT_ITEM PANEL_LIST_MODE
PANEL_DEFAULT_VALUE PANEL_LIST_NEXT_SELECTED
PANEL_DIRECTION PANEL_LIST_NROWS
PANEL_DISPLAY_LEVEL PANEL_LIST_ROW_HEIGHT
PANEL_DISPLAY_ROWS PANEL_LIST_SCROLLBAR
PANEL_DROP_BUSY_GLYPH PANEL_LIST_SELECT
Panels
Panels 209
Table 7-5. Panel Package Attributes (continued)
Panel Attributes
PANEL_DROP_DND PANEL_LIST_SELECTED
PANEL_DROP_FULL PANEL_LIST_SORT
PANEL_DROP_GLYPH PANEL_LIST_STRING
PANEL_DROP_HEIGHT PANEL_LIST_STRINGS
PANEL_DROP_SEL_REQ PANEL_LIST_TITLE
PANEL_DROP_SITE_DEFAULT PANEL_LIST_WIDTH
PANEL_DROP_WIDTH PANEL_MASK_CHAR
PANEL_EVENT_PROC PANEL_MAX_TICK_STRING
PANEL_EXTRA_PAINT_HEIGHT PANEL_MAX_VALUE
PANEL_EXTRA_PAINT_WIDTH PANEL_MAX_VALUE_STRING
PANEL_FEEDBACK PANEL_MIN_TICK_STRING
PANEL_FIRST_ITEM PANEL_MIN_VALUE
PANEL_FIRST_PAINT_WINDOW PANEL_MIN_VALUE_STRING
PANEL_FOCUS_PW PANEL_NCHOICES
PANEL_GAUGE_WIDTH PANEL_NEXT_COL
PANEL_GINFO PANEL_NEXT_ITEM
PANEL_INACTIVE PANEL_NEXT_ROW
PANEL_ITEM_CLASS PANEL_NO_REDISPLAY_ITEM
PANEL_ITEM_COLOR PANEL_NOTIFY_LEVEL
PANEL_ITEM_CREATED PANEL_NOTIFY_PROC
PANEL_ITEM_DEAF PANEL_NOTIFY_STATUS
PANEL_ITEM_LABEL_RECT PANEL_NOTIFY_STRING
PANEL_ITEM_MENU PANEL_OPS_VECTOR
PANEL_ITEM_NTH_WINDOW PANEL_PAINT
PANEL_ITEM_NWINDOWS PANEL_PRIMARY_FOCUS_ITEM
PANEL_ITEM_RECT PANEL_READ_ONLY
PANEL_ITEM_VALUE_RECT PANEL_REPAINT_PROC
PANEL_ITEM_WANTS_ADJUST PANEL_SHOW_RANGE
PANEL_ITEM_WANTS_ISO PANEL_SHOW_VALUE
PANEL_ITEM_X PANEL_SLIDER_END_BOXES
PANEL_ITEM_X_GAP PANEL_SLIDER_WIDTH
PANEL_ITEM_X_POSITION PANEL_STATUS
PANEL_ITEM_Y PANEL_TEXT_SELECT_LINE
PANEL_ITEM_Y_GAP PANEL_TICKS
PANEL_ITEM_Y_POSITION PANEL_TOGGLE_VALUE
PANEL_JUMP_DELTA PANEL_VALUE
PANEL_LABEL_BOLD PANEL_VALUE_DISPLAY_LENGTH
PANEL_LABEL_FONT PANEL_VALUE_DISPLAY_WIDTH
PANEL_LABEL_IMAGE PANEL_VALUE_FONT
PANEL_LABEL_STRING PANEL_VALUE_STORED_LENGTH
PANEL_LABEL_WIDTH PANEL_VALUE_UNDERLINED
PANEL_LABEL_X PANEL_VALUE_X
PANEL_LABEL_Y PANEL_VALUE_Y
210 XView Programming Manual
Table 7-6. New and Changed Panel Package Attributes (Version 3.2)
PANEL_LIST_INACTIVE PANEL_LIST_MASK_GLYPHS
PANEL_LIST_DELETE_INACTIVE_ROWS PANEL_LIST_ROW_VALUES
PANEL_LIST_DO_DBL_CLICK PANEL_LIST_EXTENSION_DATA
PANEL_LIST_MASK_GLYPH PANEL_LIST_EXTENSION_DATAS
Panels
Panels 211
Get Volume 7A: XView Programming Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.