[comp.windows.x] A MAC dialog implementation

dsseewe@SUPER.ORG (Daniel Seewer) (08/03/89)

	Well I have a question that may have no solution!  I am trying to
imitate the Mac look-and-feel for a dialog box.  When the box pops up I want
the users input focused to the text widget of the dialog widget.  This seems
simple by using the XtSetKeyboardFocus() call.  But this call needs two widgets
the parent and the child to focus input to.  Well how do I obtain the text
widget of the dialog widget without dipping into the Private stuff????
Or do I have to create my own dialog box consisting of a label widget and 
asciiString widget so I can have direct access to the desired widget to focus
on.  
	Another nice featrue that I would like to implement is when the 
return key is pressed it will invoke the "confirm" button attached to the 
dialog widget.  I seem to remember some chatter a while back discussing this
issue stating that one could not do from inside the program but could through
the resource database.  Does anyone remember this conversation??  Is the 
translation table the way to go for this idea?  That is when return is pressed
I will call a routine that will then invoke the callback associated with the
"confirm" button.  Thanks in advance!!!!!!!


			Dan Seewer
			(dsseewe@super.org)

mende@athos.rutgers.edu (Bob Mende Pie) (08/04/89)

In article <8908031514.AA05636@metropolis.super.org> dsseewe@SUPER.ORG (Daniel Seewer) writes:

> 	Well I have a question that may have no solution!  I am trying to
> imitate the Mac look-and-feel for a dialog box. 

there is a program called xprompt that will do much of this... it allows a
prompt to be sent, with a default answer using the Xw text widget.  It can
(optionaly) focus input.   I use it and have not had any problems.  It is
not fancy, but functional.


					/Bob...
-- 

mlm@calmasd.Prime.COM (Monte Meals) (08/05/89)

In article <8908031514.AA05636@metropolis.super.org>, dsseewe@SUPER.ORG (Daniel Seewer) writes:
> 
> 	Well I have a question that may have no solution!  I am trying to
> imitate the Mac look-and-feel...

I'de keep this real quiet unless you want a "Mac Suit"

Monte

converse@EXPO.LCS.MIT.EDU (Donna Converse) (08/07/89)

> I am trying to
> imitate the Mac look-and-feel for a dialog box.  When the box pops up I want
> the users input focused to the text widget of the dialog widget.

If your mouse pointer is within the bounds of the dialog box, the keyboard
input will be directed to the text value widget in the dialog box.
If you want user input to the rest of your application to be ignored while the
dialog box is up, you can use XtGrabExclusive in the popup call, instead of
XtGrabNone.  If you want still stronger medicine, you must be intending that
your application will prevent user input to other applications on the screen.
In that case, refer to the Inter-Client Communications Conventions Manual.

> Well how do I obtain the text
> widget of the dialog widget without dipping into the Private stuff????

The instance name of the Dialog's text widget is given on page 39 of the
Athena widget documentation.  You can use XtNameToWidget to get what you need.

> 	Another nice featrue that I would like to implement is when the 
> return key is pressed it will invoke the "confirm" button attached to the 
> dialog widget.
> That is when return is pressed
> I will call a routine that will then invoke the callback associated with the
> "confirm" button.  

Write an action routine which calls your confirm callback routine, declare an
action table and register it with the translation manager.  Create an
application defaults file for your application, if you don't already have one,
and put your event translation in it.  Suppose Demo is your app class.

Demo*Dialog.value.translations: #override\n\
	<Key>Return: confirm-action()\n


Donna Converse
converse@expo.lcs.mit.edu

converse@EXPO.LCS.MIT.EDU (Donna Converse) (08/07/89)

In my previous message, I erroneously claimed:
	
> If your mouse pointer is within the bounds of the dialog box, the keyboard
> input will be directed to the text value widget in the dialog box.

A blatant lie, in R3.  Use XtSetKeyboardFocus to get this effect.


Donna Converse
converse@expo.lcs.mit.edu