home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / windows / x / motif / 8192 < prev    next >
Encoding:
Text File  |  1992-12-23  |  1.3 KB  |  41 lines

  1. Newsgroups: comp.windows.x.motif
  2. Path: sparky!uunet!think.com!paperboy.osf.org!juliet!daniel
  3. From: daniel@juliet.osf.org (Daniel Dardailler)
  4. Subject: Re: Centering button in form ?
  5. Message-ID: <1992Dec23.142215.9700@osf.org>
  6. Sender: daniel@juliet (Daniel Dardailler)
  7. Organization: Open Software Foundation, Motif Team
  8. References:  <1992Dec22.175107.3484@news.dfrf.nasa.gov>
  9. Date: Wed, 23 Dec 1992 14:22:15 GMT
  10. Lines: 29
  11.  
  12.  
  13. |>  -------------------------------
  14. |> |       ----------------        |
  15. |> |      |                |       |
  16. |> |       --XmPushButton--        |
  17. |>  ------------------------XmForm-
  18.  
  19.  
  20. Form does not support center attachment as a resource.
  21. You'll need to do some programming.
  22.  
  23. You have to wait for after the Form first layout to be sure everybody
  24. got its natural size (the button and the form here).
  25. (unless you want to fix the sizes of your widgets, which is very bad).
  26.  
  27. Calling a routine after XtRealize and before the main loop is fine.
  28.  
  29. In this routine, do something like:
  30.  
  31.         n = 0;
  32.     XtSetArg (args[n], XmNwidth, &width);  n++;
  33.     XtGetValues (push, args, n);
  34.  
  35.     n = 0;
  36.     XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION);  n++;
  37.     XtSetArg (args[n], XmNleftPosition, 50);  n++;
  38.     XtSetArg (args[n], XmNleftOffset, -((int)width)/2);  n++;
  39.     XtSetValues (push, args, n);
  40.  
  41.