mdonahue@convex.com (Mike Donahue) (02/05/91)
I have been attempting to port some sunview programs to Xview and have had some mild success, however, I have a program which uses several of the menu widgets from Xview and I cannot get it to work when I attempt to pop up the menu with a menu_show I get this error message : XView warning: menu_show: menu not owned by this server (Command Menu package) endless tweeking of the code did not seem to help so I typed in the simple menu program found in the Xview manual and it seems to do the same thing Code Follows (from X manual 7 : 236) -------------------------------------------------------------------- . . . initialization stuff . . . canvas = (Canvas)xv_create(frame, CANVAS, XV_WIDTH, 300, XV_HEIGHT, 200, NULL); scrollbar = (Scrollbar)xv_create(canvas,SCROLLBAR, SCROLLBAR_DIRECTION, SCROLLBAR_VERTICAL, NULL); M_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(M_menu,canvas_pw,event, NULL); } } At any rate this code gets the same error as above. Has anyone encountered this before ? Any suggestions or hints ? Am I missing something fundamental here ? Mike Donahue (mdonahue@convex.com) 214-497-4051
rick@pbi.COM (Richard M. Goldstein) (02/05/91)
From: uunet!convex.com!mdonahue (Mike Donahue) Organization: Convex Computer Corporation, Richardson, Tx. Subject: Menus in Xview I have been attempting to port some sunview programs to Xview and have had some mild success, however, I have a program which uses several of the menu widgets from Xview and I cannot get it to work when I attempt to pop up the menu with a menu_show I get this error message : XView warning: menu_show: menu not owned by this server (Command Menu package) at a glance, it seems to me that menus in XView need to be parented to a server object (the default server is used if you specify XV_NULL as the parent to xv_create() ). I suspect your error was to parent a menu to a canvas object. hope this helps, rick %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Richard M. Goldstein % % % % Perfect Byte, Inc. Phone: (402)554-1122 % % 7121 Cass St. Fax: (402)554-1938 % % Omaha, NE 68132 email: rick@pbi.com % % % % "If I knew what I was doing, % % d'ya think I'd be in Omaha?" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%