home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x.motif
- Path: sparky!uunet!cs.utexas.edu!asuvax!ennews!enuxha.eas.asu.edu!akhtar
- From: akhtar@enuxha.eas.asu.edu (Naeem Akhtar)
- Subject: Help
- Message-ID: <1993Jan22.085129.1554@ennews.eas.asu.edu>
- Keywords: pixmap in cascade buttons
- Sender: news@ennews.eas.asu.edu (USENET News System)
- Organization: Arizona State University
- Date: Fri, 22 Jan 1993 08:51:29 GMT
- Lines: 91
-
-
- Hi folks!
-
- I'm a novice in X-world and trying to learn X. I have following
- question (1 of many) and hope some guru will reply.
-
- Q. I am trying to create a menu-bar and want to have a pixmap
- as label in the cascade button (having pulldown menu as child).
- And guess what :- Error.
- Here is a part of the code (There might be something syntax errors).
-
- /** All the includes **/
-
- /* Global Vars */
- Arg args[MAX_ARGS];
- Pixmap apple;
-
- Widget CreateMenu (parent)
- Widget parent;
- {
- Widget menubar, menu_pane;
- int n;
-
- n = 0;
- menu_bar = XmCreateMenuBar (parent, "Menu_Bar", args, n);
-
- menu_pane = XmCreatePulldownMenu (menu_bar, "File", args, n);
-
- XtManageChild (XtCreatePushButton (menu_pane, "Quit", args, n));
-
- XtSetArgs (args[n], XmNsubMenuId, menu_pane);
- XtSetArgs (args[n], XmNlabelType, XmPIXMAP);
- XtSetArgs (args[n], XmNlabelPixmap, apple);
- cascade = XmCreateCascadeButton (menu_bar, NULL, args, n);
- XtManageChild (cascade);
-
- return (menubar);
- }
-
- void main (args, argv)
- unsinged int args;
- char **argv;
- {
- Widget topLevel, appshell, menu_bar, frame;
- XtAppContext app_context;
-
- topLevel = XtAppInitialize (&app_context, "Mac", NULL, 0, &argc,
- argv, NULL, args, 0);
-
- apple = XCreateBitmapFromData (XtDisplay (topLevel),
- RootWindowOfScreen (XtScreen (topLevel)),
- Icon_bits,
- Icon_width,
- Icon_height);
-
- XtSetArg (args[n], XmNiconic, TRUE); n++;
- XtSetArg (args[n], XmNiconPixmap, apple); n++;
- XtSetValues (topLevel, args, n);
-
-
- XtSetArg (args[n], XmNwidth, 200); n++;
- XtSetArg (args[n], XmNheight, 200); n++;
- appshell = XmCreateMainWindow (topLevel, "Main_Window", args, n);
- XtManageChild (appshell);
-
- menu_bar = CreateMenuBar (appshell);
- XtManageChild (menu_bar);
-
- frame = XmCreateRowColumn (appshell, "Frame", args, n);
- XtManageChild (frame);
-
- XmMainWindowSetAreas (appshell, menu_bar, NULL, NULL, NULL, frame);
-
-
- XtRealizeWidget (topLevel);
- XtAppMainLoop (app_context);
-
- }
-
- If your answer is :-
- I havn't created GC (I don't know what is that so far), then please
- explain shortly what is GC? Why we need it here not in XmDrawnButton.
- ---
-
- Thanks in advance.
- Naeem!
- --
- <<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>> | God is real |
- << M. N. Akhtar Arizona State University >> | unless |
- << akhtar@enuxha.eas.asu.edu >> | declared |
- <<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>> | integer |
-