home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!vtserf!creatures!csgrad.cs.vt.edu!ramakris
- From: ramakris@csgrad.cs.vt.edu (S.Ramakrishnan)
- Newsgroups: comp.windows.x.motif
- Subject: Re: Centering button in form ?
- Message-ID: <3953@creatures.cs.vt.edu>
- Date: 24 Dec 92 03:23:35 GMT
- References: <1992Dec22.175107.3484@news.dfrf.nasa.gov> <1992Dec23.142215.9700@osf.org> <3952@creatures.cs.vt.edu>
- Sender: usenet@creatures.cs.vt.edu
- Organization: VPI&SU Computer Science Department, Blacksburg, VA
- Lines: 40
-
- In article <3952@creatures.cs.vt.edu> ramakris@csgrad.cs.vt.edu (S.Ramakrishnan) writes:
- >In article <1992Dec23.142215.9700@osf.org > daniel@juliet.osf.org (Daniel Dardailler) writes:
- >
- > >|> -------------------------------
- > >|> | ---------------- |
- > >|> | | | |
- > >|> | --XmPushButton-- |
- > >|> ------------------------XmForm-
- >
- >
- > >In this routine, do something like:
- > >
- > > n = 0;
- > > XtSetArg (args[n], XmNwidth, &width); n++;
- > > XtGetValues (push, args, n);
- > >
- > > n = 0;
- > > XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
- > > XtSetArg (args[n], XmNleftPosition, 50); n++;
- > > XtSetArg (args[n], XmNleftOffset, -((int)width)/2); n++;
- > > XtSetValues (push, args, n);
- >
- >This fragment of code is likely to yield funny results.
- >XmNleftPosition indicates not the x-coordinate but the 50th grid
- >position where the number of grid elements is set by XmNfractionBase (a
- >form resource).
-
- Before I get flamed...
-
- Looks like the default value of XmNfractionBase is 100. That being the
- case, the leftedge of the button will be at halfway point in the form -
- which still does not centre the button.
-
- At any rate, the non-zero value of XmNleftOffset will be completely
- ignored.
-
- (...)
-
- ---
- S Ramakrishnan, CS Dept, McBryde Hall, VaTech
-