[comp.windows.x.motif] Positioning dialogs, etc

pelakh@convex.com (Boris Pelakh) (11/08/90)

I have two questions :

1. I am creating a popup with XmCreateFormDialog. How can I give it a screen 
   position other than the default center ? I tried setting the x and y for
   its parent, the shell, but it didn't seem to work.

2. How can create a XmScale so that I can change the value with XmScaleSetValue
   while not letting the user to modify the value using the mouse ?

Please reply in e-mail


--

Boris Pelakh				"A day without sunshine is like
					 a night"
pelakh@convex.com			 		-- Steve Martin

bazavan@hpcilzb.HP.COM (Valentin Bazavan) (11/13/90)

Here is an answer for your first question:

Set the XmNdefaultPosition to False when you create the dialog.
E.g.:
	n = 0;
	.
	.
	XtSetArg(args[n], XmNdefaultPosition, False); n++;
	Widget dialog = XmCreate<your>Dialog(parent, "blabla", args, n);

Then 
	Position x, y;
	/* get root-relative x and y coordinates of the parent */
	XtTranslateCoords(parent, 0, 0, &x, &y);
	/* move the dialog to the position you want relative to parent's x, y */
	XtMoveWidget(dialog, x+100, y-100);


Valentin Bazavan
vbazavan@hpdtc.hp.com

dex@hpcvlx.cv.hp.com (Dex Smith) (11/15/90)

>1. I am creating a popup with XmCreateFormDialog. How can I give it a screen 
>   position other than the default center ? I tried setting the x and y for
>   its parent, the shell, but it didn't seem to work.

Set the dialog's "defaultPosition" resource to False.  This resource is 
brought to the party by the XmBulletinBoard widget class (which is the source
for many important "dialog" features).

- Dex Smith

  Interface Technology Operation
  Hewlett-Packard Company
  Corvallis, Oregon
  dex@hpcvlx.hp.com

ron@modcomp.uucp (Ron Stoehr) (11/16/90)

tsang@ISI.COM (Kam C. Tsang) writes:

>> 2. How can create a XmScale so that I can change the value with XmScaleSetValue
>>    while not letting the user to modify the value using the mouse ?

>One way is to set the sensitivity of the XmScale to FALSE.

>Hope it helps.

This works, but has one drawback. If you just set the scale widget insensitive,
the associated label widget becomes insensitive as well!

You can prevent this by using the following code:

XtSetSensitive (XtNameToWidget (scale_widget, "scale_scrollbar"), False);

This way you are only affecting the scrollbar of the scale widget and the
label remains readable...

	Ronald Stoehr			Modular Computer Systems, Inc.
	voice: (305) 977-1009		1650 W. McNab Road
	fax:   (305) 977-1440		Ft. Lauderdale, FL 33340-6099