gjw@ANDREAS.WR.USGS.GOV (Gregory J. Woodhouse) (11/06/90)
I guess I forgot to load a library (olgx), but when I try to run this program I get XView warning: menu_show not owned by this server (Command Menu package) recall that I'm running XView under SunOs 4.1, and the program in question is an example from vol. 7 of the O'Reilly series; viz., #include <xview/xview.h> #include <xview/canvas.h> #include <xview/scrollbar.h> #define SCROLLBAR_KEY 100 #define MENU_KEY 200 main(argc, argv) int argc; char *argv[]; { Frame frame; Canvas canvas; Scrollbar scrollbar; Menu menu; void menu_notify_proc(), pw_event_proc(); xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL); frame = (Frame) xv_create(NULL, FRAME, FRAME_LABEL, argv[0], NULL); canvas = (Canvas) xv_create(frame, CANVAS, XV_WIDTH, 300, XV_HEIGHT, 200, NULL); scrollbar = (Scrollbar) xv_create(canvas, SCROLLBAR, SCROLLBAR_DIRECTION, SCROLLBAR_VERTICAL, NULL); menu = (Menu) xv_create(canvas, MENU, MENU_TITLE_ITEM, "Scrollbar", MENU_STRINGS, "On", "Off", NULL, MENU_NOTIFY_PROC, menu_notify_proc, XV_KEY_DATA, SCROLLBAR_KEY, scrollbar, NULL); xv_set(canvas_paint_window(canvas), WIN_EVENT_PROC, pw_event_proc, XV_KEY_DATA, MENU_KEY, menu, NULL); window_fit(frame); window_main_loop(frame); } void menu_notify_proc(menu, menu_item) Menu menu; Menu_item menu_item; { char *menu_choice = (char *) xv_get(menu_item, MENU_STRING); int show_it = !strcmp(menu_choice, "On"); xv_set(xv_get(menu, XV_KEY_DATA, SCROLLBAR_KEY), XV_SHOW, show_it, NULL); } void pw_event_proc(canvas_pw, event) Xv_Window canvas_pw; Event *event; { if (event_action(event) == ACTION_MENU && event_is_down(event)) { Menu menu = (Menu) xv_get(canvas_pw, XV_KEY_DATA, MENU_KEY); menu_show(menu, canvas_pw, event, NULL); } } ----------------------------------------------------------------------------- Gregory Woodhouse |We know that the center of the earth gjw@andreas.wr.usgs.gov |is a fiery molten mass...but it's not (415) 329-4694 (office) |good to dwell on it. (415) 325-7802 (home) | U.S. Geological Survey / 345 Middlefield Rd. MS 977 / Menlo Park, CA 94025 -----------------------------------------------------------------------------