home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / windows / x / motif / 8748 < prev    next >
Encoding:
Text File  |  1993-01-22  |  3.0 KB  |  103 lines

  1. Newsgroups: comp.windows.x.motif
  2. Path: sparky!uunet!cs.utexas.edu!asuvax!ennews!enuxha.eas.asu.edu!akhtar
  3. From: akhtar@enuxha.eas.asu.edu (Naeem Akhtar)
  4. Subject: Help
  5. Message-ID: <1993Jan22.085129.1554@ennews.eas.asu.edu>
  6. Keywords: pixmap in cascade buttons
  7. Sender: news@ennews.eas.asu.edu (USENET News System)
  8. Organization: Arizona State University
  9. Date: Fri, 22 Jan 1993 08:51:29 GMT
  10. Lines: 91
  11.  
  12.  
  13. Hi folks!
  14.  
  15.     I'm a novice in X-world and trying to learn X. I have following
  16. question (1 of many) and hope some guru will reply.
  17.  
  18. Q.    I am trying to create a menu-bar and want to have a pixmap
  19.     as label in the cascade button (having pulldown menu as child).
  20.     And guess what :- Error.
  21.     Here is a part of the code (There might be something syntax errors).
  22.     
  23.     /**    All the includes **/
  24.  
  25.     /* Global Vars */
  26.     Arg        args[MAX_ARGS];
  27.     Pixmap    apple;
  28.  
  29.     Widget CreateMenu (parent)
  30.     Widget    parent;
  31.     {
  32.         Widget    menubar, menu_pane;
  33.         int        n;
  34.  
  35.         n = 0;
  36.         menu_bar = XmCreateMenuBar (parent, "Menu_Bar", args, n);
  37.  
  38.          menu_pane = XmCreatePulldownMenu (menu_bar, "File", args, n);
  39.  
  40.         XtManageChild (XtCreatePushButton (menu_pane, "Quit", args, n));
  41.  
  42.         XtSetArgs (args[n], XmNsubMenuId, menu_pane);
  43.         XtSetArgs (args[n], XmNlabelType, XmPIXMAP);
  44.         XtSetArgs (args[n], XmNlabelPixmap, apple);
  45.         cascade = XmCreateCascadeButton (menu_bar, NULL, args, n);
  46.         XtManageChild (cascade);
  47.         
  48.         return (menubar);
  49.     }
  50.  
  51.     void main (args, argv)
  52.     unsinged int args;
  53.     char         **argv;
  54.     {
  55.         Widget            topLevel, appshell, menu_bar, frame;
  56.         XtAppContext    app_context;
  57.  
  58.         topLevel = XtAppInitialize (&app_context, "Mac", NULL, 0, &argc,
  59.                     argv, NULL, args, 0);
  60.  
  61.         apple = XCreateBitmapFromData (XtDisplay (topLevel),
  62.                                     RootWindowOfScreen (XtScreen (topLevel)),
  63.                                     Icon_bits,
  64.                                     Icon_width,
  65.                                     Icon_height);
  66.  
  67.         XtSetArg (args[n], XmNiconic, TRUE); n++;
  68.         XtSetArg (args[n], XmNiconPixmap, apple); n++;
  69.         XtSetValues (topLevel, args, n);
  70.  
  71.  
  72.         XtSetArg (args[n], XmNwidth, 200); n++;
  73.         XtSetArg (args[n], XmNheight, 200); n++;
  74.         appshell = XmCreateMainWindow (topLevel, "Main_Window", args, n);
  75.         XtManageChild (appshell);
  76.  
  77.         menu_bar = CreateMenuBar (appshell);
  78.         XtManageChild (menu_bar);
  79.  
  80.         frame = XmCreateRowColumn (appshell, "Frame", args, n);
  81.         XtManageChild (frame);
  82.  
  83.         XmMainWindowSetAreas (appshell, menu_bar, NULL, NULL, NULL, frame);
  84.  
  85.  
  86.         XtRealizeWidget (topLevel);
  87.         XtAppMainLoop (app_context);
  88.  
  89.     }
  90.  
  91. If your answer is :-
  92.     I havn't created GC (I don't know what is that so far), then please
  93.     explain shortly what is GC? Why we need it here not in XmDrawnButton.
  94.                                    ---
  95.  
  96. Thanks in advance.
  97. Naeem!
  98. --
  99. <<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>> |       God is real      |
  100. << M. N. Akhtar      Arizona State University  >> |         unless         |
  101. <<      akhtar@enuxha.eas.asu.edu              >> |        declared        |
  102. <<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>> |         integer        |
  103.