[comp.windows.x.motif] how do I left-justify the text in a push-button?

wws@rruxc.uucp (Still Searching) (05/31/91)

I'm placing some XmString text, created with XmStringCreateLtoR,
in Push-Buttons which are on a bulletin board in a scrolled window.
The text is always centered in the buttons; I want it left-justified.

I have a feeling this is happening because everything is in a Form dialog with
ATTACH_POSITION specified for all four sides of all widgets.  Is there a way
to get the text to shift to the left in the buttons?

Thank you,
Wayne Scott
----------------------------------------------
	wws@bcr.cc.bellcore.com
I'm just a soul whose intentions are good,
Oh Lord, please don't let me be misunderstood.

meeks@osf.org (W. Scott Meeks) (05/31/91)

>Date: 30 May 91 19:51:37 GMT
>From: porthos!rruxc!wws@bellcore.com  (Still Searching)
>
>I'm placing some XmString text, created with XmStringCreateLtoR,
>in Push-Buttons which are on a bulletin board in a scrolled window.
>The text is always centered in the buttons; I want it left-justified.
>
>I have a feeling this is happening because everything is in a Form dialog with
>ATTACH_POSITION specified for all four sides of all widgets.  Is there a way
>to get the text to shift to the left in the buttons?

Well, I generally hate to say this, but in this case, RTFM.  There is a
resource in XmLabel (of which XmPushButton is a subclass) called
XmNalignment which can take one of three values: XmALIGNMENT_BEGINNING
(which is effectively left alignment when XmNstringDirection is
XmSTRING_DIRECTION_L_TO_R), XmALIGNMENT_CENTER (the default) and
XmALIGNMENT_END.  See the documentation on XmLabel for more information.

W. Scott Meeks           
Open Software Foundation 
meeks@osf.org            
(617) 621-7229           

jon@kitty.austin.ibm.com (Werner) (05/31/91)

In article <1991May30.195137.23995@porthos.cc.bellcore.com>, wws@rruxc.uucp (Still Searching) writes:
|> I'm placing some XmString text, created with XmStringCreateLtoR,
|> in Push-Buttons which are on a bulletin board in a scrolled window.
|> The text is always centered in the buttons; I want it left-justified.
|> 
|> I have a feeling this is happening because everything is in a Form dialog with
|> ATTACH_POSITION specified for all four sides of all widgets.  Is there a way
|> to get the text to shift to the left in the buttons?

What you need to do is set the XmNalignment resource of the label widget to
XmALIGNMENT_BEGINNING. The default is XmALIGNMENT_CENTER. You can also use
XmALIGNMENT_END for right justification.
-- 
______________________________________________________________________________
jon@innerdoor.austin.ibm.com		* Insert Standard Disclaimer here *
IBM Advanced Workstations Division 
Austin, Texas USA 512-823-5156

kendall@hottub.b11.ingr.com (Kendall Schmidt) (05/31/91)

In article <1991May30.195137.23995@porthos.cc.bellcore.com>, wws@rruxc.uucp (Still Searching) writes:
|> I'm placing some XmString text, created with XmStringCreateLtoR,
|> in Push-Buttons which are on a bulletin board in a scrolled window.
|> The text is always centered in the buttons; I want it left-justified.
|> 

The PushButton inherites the resources from Label. You may want to try setting
the resource XmNalignment to XmALIGNMENT_BEGINNING to get the label
left-justified.

|> I have a feeling this is happening because everything is in a Form dialog with
|> ATTACH_POSITION specified for all four sides of all widgets.  Is there a way
|> to get the text to shift to the left in the buttons?
|> 

I don't know if this will impact my suggestion.

|> Thank you,
|> Wayne Scott
|> ----------------------------------------------
|> 	wws@bcr.cc.bellcore.com
|> I'm just a soul whose intentions are good,
|> Oh Lord, please don't let me be misunderstood.

-- 

  Kendall Schmidt	    |	Intergraph Corp.   |	e-mail:
  Graphics Standards	    |	Huntsville, AL.	   |	kendall@ingr.com
  X Window System	    |	205-730-4061	   |	uunet!ingr!kendall

vendiswc@aix.aix.kingston.ibm.com (Shaun Codner) (06/01/91)

In article <1991May30.195137.23995@porthos.cc.bellcore.com> wws@rruxc.uucp (Still Searching) writes:
>I'm placing some XmString text, created with XmStringCreateLtoR,
>in Push-Buttons which are on a bulletin board in a scrolled window.
>The text is always centered in the buttons; I want it left-justified.
...
>Wayne Scott
>----------------------------------------------
>	wws@bcr.cc.bellcore.com
I think what you are looking for is the XmNalignment resource inherited from
the XmLabel widget class.  It can be set to XmALIGNMENT_BEGINNING (left
justified).  The default is XmALIGNMENT_CENTER which is what I guess you are
seeing.

Depending on the situation, your mileage may vary.
-Shaun
-- 
------------------------------------------------------------------------------
--- Shaun Codner	Telephone 914-385-7189		Office 025-3 4W01  ---
--- Pencom Systems, Inc.	  TIE 695-7189		E-Mail swc@frantic ---
------------------------------------------------------------------------------