[comp.windows.x] help with athena widgets

bobmi@hpcvlx.HP.COM (Bob Miller) (10/05/88)

There's a toggle button widget in HP public domain widget library.
You should be able to use it in concert with the athena widgets
you're using.

radoslav@kuling.UUCP (Radoslav Bogdanovic) (11/30/89)

-- 
____________________________________________________________________________
Radoslav (Raddo) Bogdanovic  - RadoSoft       | radoslav@kuling.docs.uu.se |
Dept. of Computer Systems, Uppsala University | radoslav@cdg.docs.uu.se    |
----------------------------------------------------------------------------

marg@cunixf.cc.columbia.edu (Margarita Suarez) (12/14/89)

i'm preparing a final project for a user interfaces class, and i'm
running into a few obstacles using athena widgets (nah, you don't say?).
here are a few questions i hope someone can answer...

1)  how do i get awm not to decorate the windows in my application?
    what resources must be referenced/defined and how do i do it?

2)  how can i define the geometries of application shell windows besides
    doing it in .Xresources?  i will be creating several "parent" shells and
    i want the windows to come up in predetermined locations on the
    screen.

3)  how do i *add* a routine to the default event translations for a
    widget?  i would like to have the event manager call my own routine in
    addition to the default routine, but if i use XtAugmentTranslations, the
    event manager ignores duplicate events.  for example, i would like
    to have <Btn1Dn> in a text widget call my routine HighlightLabel and
    also call the default routine for this event, SelectStart.  problem is
    that all the routines defined in Text.c and TextTr.c are declared
    static, so i can't call them myself.  any ideas?

i thank you all for your several prompt and enlightening responses.  :-)

marg

 VOICE:  w:212-854-5434 h:212-932-3023 | The important thing about a battleship
INTERNET:  marg@cunixc.cc.columbia.edu | is that it shoots.  It floats, and it
 BITNET:            marg@cunixc.bitnet | is a ship, but the important thing
  UUCP:  !rutgers!columbia!cunixc!marg | about a battle ship is that it shoots.

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (12/14/89)

> 1)  how do i get awm not to decorate the windows in my application?
>    what resources must be referenced/defined and how do i do it?

I believe that the awm man page explains how to turn off decorations on certain
the windows if a given appliacation.  This is specifiable by the user of awm,
not the application programmer.

> 2)  how can i define the geometries of application shell windows besides
>     doing it in .Xresources?  i will be creating several "parent" shells and
>     i want the windows to come up in predetermined locations on the
>     screen.

Using TransientShellWidgetClass will usually place the window where the
application specifies in the XtNx and XtNy resources, w/o a geometry
specification (the exact semantics are left up to the window manager).  It may
also cause the window manager not to decorate the window (again this is left up
to the specific window manager).

> 3)  how do i *add* a routine to the default event translations for a
>     widget? i would like to have the event manager call my own routine in
>     addition to the default routine, but if i use XtAugmentTranslations, the
>     event manager ignores duplicate events.

Really?? I think that Augment should do the right thing.

>   for example, i would like
>   to have <Btn1Dn> in a text widget call my routine HighlightLabel and
>   also call the default routine for this event, SelectStart.

In order to make sure you get the order right I would suggest using something
like this:

{
	static char trans[] = "<Btn1Down>:     HighlightLabel() select-start()";

	XtOverrideTranslations(widget, XtParseTranslationTable(trans));
}

You will need to register your action with XtAppAddActions(), of course.
This will guarantee that your action will be called before select-start().

>    problem is
>    that all the routines defined in Text.c and TextTr.c are declared
>    static, so i can't call them myself.

This is not a problem, but a feature, the implementation of these routines is 
internal to the Text widget (and may change w/o notice).


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213

marg@CUNIXF.CC.COLUMBIA.EDU (Margarita Suarez) (12/14/89)

thanks for your reply...i've gotten my program to do mostly what i want.
what i ended up doing is setting XtNoverrideRedirect to True for a
topLevelShell widget, and this overrides the window manager and also
allows me to specify values for XtNx and XtNy, etc.

the problem with the translation table is solved, but i did have to
place the line
	{ "select-start", NULL },
into my action table to trick the action parser into thinking it knew
where that routine was.  otherwise, i would get warnings from the parser
saying it didn't know that action.  since i was getting those warnings
before, i assumed that i had to put SelectStart in my action table, and
then it couldn't find that, etc.

is it true, then, that window manager like things (geometry, decoration)
for the toplevel widget (that created with XtInitialize) must be
modified only from the window manager end?

marg

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (12/14/89)

> I've gotten my program to do mostly what i want.
> what i ended up doing is setting XtNoverrideRedirect to True for a
> topLevelShell widget

This is okay for a demo, but really EVIL for a real application, since it does
not let the user reposition this window with the window manager.  The rule of
thumb that I use is not to use OverrideRedirect unless there is a server grab
active for the entire time the window is active.  Have you tried using a
transient shell instead?

> but i did have to place the line
> 	{ "select-start", NULL },
> into my action table to trick the action parser into thinking it knew
> where that routine was.

This is probabally because you are using a resource line of:

*Text*tranlations:

This assignes translations to the children of the Text widget, which in this
case is a scrollbar that does not know about the select-start action.

> is it true, then, that window manager like things (geometry, decoration)
> for the toplevel widget (that created with XtInitialize) must be
> modified only from the window manager end?

I am not sure what you are asking, these are things the window manager controls,
and as such only the owner of the window manager can modify them, or be 100%
certain that things act a certain way.  There are certain conventions described
in the ICCCM manual which help application programmers do the "right" thing.



						Chris

pusateri@macbeth.cs.duke.edu (Thomas J. Pusateri) (12/14/89)

In article <1989Dec13.165245.9710@cunixf.cc.columbia.edu> marg@cunixf.cc.columbia.edu (Margarita Suarez) writes:
>
>1)  how do i get awm not to decorate the windows in my application?
>    what resources must be referenced/defined and how do i do it?

In your .Xdefaults file put the following lines. 'program' is the name of
your program:

program*wm_option.gadgets:   off
program*wm_option.title:     off

This is in the awm man page but is hard to find.

Tom

pusateri@nbsr.duke.edu

tom@ICASE.EDU (Tom Crockett) (12/14/89)

> *Excerpts from xpert: 13-Dec-89 Re: help with athena widgets Chris D.*
> *Peterson@expo.l (2191)*

> > 1)  how do i get awm not to decorate the windows in my application?
> >    what resources must be referenced/defined and how do i do it?

> I believe that the awm man page explains how to turn off decorations on
> certain
> the windows if a given appliacation.  This is specifiable by the user of awm,
> not the application programmer.


My experience has been that this works for some clients, but not for others.  I
haven't figured out why.  Can anyone enlighten me?

Tom Crockett

ICASE
Institute for Computer Applications in Science and Engineering
M.S. 132C                               e-mail:  tom@icase.edu
NASA Langley Research Center            phone:  (804) 864-2182
Hampton,  VA  23665-5225