home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / windows / x / motif / 8215 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  1.8 KB

  1. Path: sparky!uunet!vtserf!creatures!csgrad.cs.vt.edu!ramakris
  2. From: ramakris@csgrad.cs.vt.edu (S.Ramakrishnan)
  3. Newsgroups: comp.windows.x.motif
  4. Subject: Re: Centering button in form ?
  5. Message-ID: <3953@creatures.cs.vt.edu>
  6. Date: 24 Dec 92 03:23:35 GMT
  7. References: <1992Dec22.175107.3484@news.dfrf.nasa.gov> <1992Dec23.142215.9700@osf.org> <3952@creatures.cs.vt.edu>
  8. Sender: usenet@creatures.cs.vt.edu
  9. Organization: VPI&SU Computer Science Department, Blacksburg, VA
  10. Lines: 40
  11.  
  12. In article <3952@creatures.cs.vt.edu> ramakris@csgrad.cs.vt.edu (S.Ramakrishnan) writes:
  13. >In article <1992Dec23.142215.9700@osf.org  > daniel@juliet.osf.org (Daniel Dardailler) writes:
  14.   >  
  15.   >  >|>  -------------------------------
  16.   >  >|> |       ----------------        |
  17.   >  >|> |      |                |       |
  18.   >  >|> |       --XmPushButton--        |
  19.   >  >|>  ------------------------XmForm-
  20.   >  
  21.   >  
  22.   >  >In this routine, do something like:
  23.   >  >
  24.   >  >        n = 0;
  25.   >  >    XtSetArg (args[n], XmNwidth, &width);  n++;
  26.   >  >    XtGetValues (push, args, n);
  27.   >  >
  28.   >  >    n = 0;
  29.   >  >    XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION);  n++;
  30.   >  >    XtSetArg (args[n], XmNleftPosition, 50);  n++;
  31.   >  >    XtSetArg (args[n], XmNleftOffset, -((int)width)/2);  n++;
  32.   >  >    XtSetValues (push, args, n);
  33.   >
  34.   >This fragment of code is likely to yield funny results. 
  35.   >XmNleftPosition indicates not the x-coordinate but the 50th grid 
  36.   >position where the number of grid elements is set by XmNfractionBase (a
  37.   >form resource).
  38.  
  39. Before I get flamed...
  40.  
  41. Looks like the default value of XmNfractionBase is 100. That being the
  42. case,  the leftedge of the button will be at halfway point in the form -
  43. which still does not centre the button.
  44.  
  45. At any rate, the non-zero value of XmNleftOffset will be completely
  46. ignored.
  47.  
  48.   (...)
  49.  
  50. ---
  51. S Ramakrishnan, CS Dept, McBryde Hall, VaTech
  52.