Skip to Main Content
Volume 7A: XView Programming Manual
book

Volume 7A: XView Programming Manual

by Dan Heller
October 1994
Intermediate to advanced content levelIntermediate to advanced
770 pages
22h 58m
English
O'Reilly Media, Inc.
Content preview from Volume 7A: XView Programming Manual
When a menu button receives an ACTION_MENU down event, the button’s notify procedure is
called before the menu is displayed. This gives you the chance to modify the menu before-
hand. When the menu button is selected by clicking the SELECT button, the button’s notify
procedure is called before the menu’s notify procedure.
Menu buttons contain a triangle pointing in the direction in which the menu will be
displayed.
The btn_menu.c program in Example 7-2 demonstrates how a menu can be attached to a pan-
el button.
Example 7-2. The btn_menu.c program
/*
* btn_menu.c -- display a panel that has an OPEN LOOK menu button.
* The choices displayed are Yes, No and Quit. If Quit is selected
* in the menu, the program exits.
*/
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/openmenu.h>
main(argc, argv)
int argc;
char *argv[ ];
{
Frame frame;
Panel panel;
Menu menu;
int selected();
void menu_proc();
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
frame = (Frame)xv_create(NULL, FRAME, NULL);
panel = (Panel)xv_create(frame, PANEL, NULL);
/* Create the menu _before_ the panel button */
menu = (Menu)xv_create(NULL, MENU,
MENU_NOTIFY_PROC, menu_proc,
MENU_STRINGS, "Yes", "No", "Quit", NULL,
NULL);
(void) xv_create(panel, PANEL_BUTTON,
PANEL_LABEL_STRING, "Y/N/Q",
PANEL_NOTIFY_PROC, selected,
PANEL_ITEM_MENU, menu, /* attach menu to button */
NULL);
window_fit(panel);
window_fit(frame);
xv_main_loop(frame);
}
int
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 6A: Motif Programming Manual

Volume 6A: Motif Programming Manual

David Brennan, Dan Heller, Paula Ferguson
Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Alejandro Terrazas, John Ostuni, Michael Barlow

Publisher Resources

ISBN: 9780937175873