[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2140.0. "<< Tracking Modal Popup Dialog Box >>" by WONDER::COMMO (I&#039;ll find no bug before its time!) Thu Jan 25 1990 09:27

I need some help.  I've scanned all the notes here, but to no avail.


The problem is how to make a popup Modal dialog box appear centered in a
certain widget no matter where that certain widget's window has been
moved.

It works fine for the first call.  There after it always comes up in the
same place.

I've summed the ...->core.x and ...->core.y values for the "calling" 
widget and all it's ancestors.  The final values of x and y do indeed
vary as I move the "calling" widget around the screen.

How do I make the popup box track it.  It is a "popup_attached_db"
widget with simpletext, label and a few push buttons.

I've tried making a separate shell (ala 2106); I've tried XtSetNormalHints.

	1) Can it be done?
	2) What's the magic incantation?

Any help appreciated.
- norm
T.RTitleUserPersonal
Name
DateLines
2140.1XtSetValues?DECWIN::KLEINThu Jan 25 1990 12:099
This may work:

Do an XtSetValues of XtNx and XtNy on the shell widget (the parent of
the dialog box itself) before you pop up the dialog box.

	{Arg args[] = {{XtNx, x}, {XtNy, y}};
	XtSetValues (XtParent (dialogBoxW), args, XtNumber (args));}

-steve-
2140.2<< Here's how it ended up working... >>WONDER::COMMOI&#039;ll find no bug before its time!Thu Jan 25 1990 14:3236
I was given the magic incantation.  Much to my chagrin it was something
that I had tried earlier.  Unfortunately I also had a couple of other
lines of code that were getting in the way and screwing things up.

A distilled version of the scenario goes like this...

void PopFunction(...)
	{
	static Widget PopW;
	int x, y;

	/* fetch it if it's the first time */
	if (!PopW)
		DwtFetchWidget(DRMid,topshell,&PopW,.......);

	XtTranslateCoords(cW,cW->core.x,cW->core.y,&x,&y);
	x += (cW->core.width/2) - (PopW->core.width/2);
	y += (cW->core.height/2) - (PopW->core.height/2);

	XtSetArg(args[0],DwtNx,x);
	XtSetArg(args[1],DwtNy,y);
	XtSetValues(PopW,args,2);

	.
	.
	. more work...
	.
	. 

	XtManageChild(PopW);
	}


cW is the widget id of the "calling" widget.  Ie, the widget where PopW
is to be centered in.