[comp.windows.x] XToolkit Question

rusty@velveeta.berkeley.edu (03/23/88)

Supposing I'm writing an application that wants to be able to display
a single line of text, and this text can be arbitrarily long, so I'd
like a horizontal scroll bar below it.  Clicking on buttons can change
this displayed text.  What's the best way to do this?  What widgets and
stuff should I use?

--------------------------------------
	rusty c. wright
	rusty@cartan.berkeley.edu ucbvax!cartan!rusty

shipley@web5a.berkeley.edu (Peter Shipley) (05/17/88)

How does a toolkit program iconify itself?

Currently I call the funtion:

static void
closewin()
{

    XWMHints    xwmh;

    extern Display  *disp;
    extern Widget toplevel;

    xwmh.flags          = StateHint;
    xwmh.initial_state  = IconicState;

    XSetWMHints(disp, XtWindow(toplevel), &xwmh);
    XFlush(disp);

    return;
}


This seems to have no effect [yes I have a window manger running],
is there a toolkit call that will do this for me?


Pete Shipley: 
email: shipley@violet.berkeley.edu           Flames:  cimarron@zen.berkeley.edu 
       pyramid!hippo!peter or ucbvax!violet!shipley   ucbvax!zen!shipley
Spelling corections: /dev/null                    Quote: "Anger is an energy"

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (05/17/88)

    Date: 17 May 88 07:26:32 GMT
    From: agate!web5a.berkeley.edu!shipley@presto.ig.com  (Peter Shipley)

    This seems to have no effect [yes I have a window manger running],

But you don't say which window manager.  For example, uwm as shipped
in V11R2 did not conform to all of the conventions in the IC3M.  And,
in fact, this is an area still under active discussion.

swick@ATHENA.MIT.EDU (Ralph R. Swick) (05/17/88)

     Date:  17 May 88 07:26:32 GMT
     From:  agate!web5a.berkeley.edu!shipley@presto.ig.com  (Peter Shipley)

     How does a toolkit program iconify itself?

     [code omitted]

     This seems to have no effect [yes I have a window manger running],
     is there a toolkit call that will do this for me?

There is a much-better-than-even chance that whatever window manager
you are running doesn't support this function yet.  None of the wm's
in X11R2 do so, and in fact the conventions for how they should do
so are still under discussion.

When the conventions are agreed upon, the Shell widget will support them
and XtSetValues, or a variant, on a Shell widget is a likely interface.

kit@athena.mit.edu (Chris D. Peterson) (05/18/88)

To Iconify a window from an application you need to tell the window manager
that something has happened, or you can think of the window manager hints as
only taking effect when the window is mapped.  In either case the solution
to you problem is to unmap and remap the window.  It will be remapped iconic.

This seems to be a bit of a brute force method, but it works, any better ideas
out there?

BTW:  There is a bug in uwm, and awm that doesn't allow the icon to be moved
      via the wm hints, once it has been created (read placed).  Take note
      all aspiring window manager authors.

						Chris Peterson     
						Project Athena     
						Systems Development

Net:	kit@athena.mit.edu		
Phone: (617) 253 - 1326			
USMail: MIT - Room E40-342C		
	77 Massachusetts Ave.		
	Cambridge, MA 02139		

rlh2@eagle.ukc.ac.uk (R.L.Hesketh) (05/18/88)

In article <10039@agate.BERKELEY.EDU> shipley@widow.berkeley.edu (Peter Shipley) writes:
>
>How does a toolkit program iconify itself?
>
>
>Pete Shipley: 

static void
closewin()
{
     Arg args[1];

     XtSetArg(args[0], XtNiconic, (XtArgVal)TRUE);

     XtSetValues(toplevel, (ArgList)1);
}

This sets the `iconic' resource of the Shell part of the top level to TRUE.
To de-iconify set it to FALSE.

Brilliant, eh?

Richard
-- 
Richard Hesketh: rlh2@ukc.ac.uk                   | "Widget programmers do it
---                                               |  with class and use a
Computing Lab., University of Kent at Canterbury, |  little inheritance"
Canterbury, Kent, CT2 7NF, England.               |

guido@cwi.nl (Guido van Rossum) (05/19/88)

In article <4992@eagle.ukc.ac.uk> rlh2@ukc.ac.uk (Richard Hesketh) writes:
>>How does a toolkit program iconify itself?
>
>static void
>closewin()
>[...]

OK, but I object to the name 'closewin'.  In my opinion, 'closing' a
window destroys it permanently; 'iconifying' a window leave an icon
around from which it can be restored exactly.  Supporting evidence: the
'close' buttons on xmh, for example.  Also, 'closing' is the
application's task, while 'iconifying' is mostly done by the window
manager (although there are certainly cases where applications want to
explicitly (de)iconify themselves under certain circumstances).

Mind you, I don't really mind how you call your functions, but I do
object to two different meanings assigned to the notion of closing a
window.  We need to set this straight.  What do *you* think?

--
Guido van Rossum, Centre for Mathematics and Computer Science (CWI), Amsterdam
guido@piring.cwi.nl or mcvax!piring!guido or guido%piring.cwi.nl@uunet.uu.net

jkh@ardent.UUCP (Jordan Hubbard) (05/26/88)

>BTW:  There is a bug in uwm, and awm that doesn't allow the icon to be moved
>     via the wm hints, once it has been created (read placed).  Take note

This has been fixed in awm. I didn't have time to get all the hint/prop
change stuff into the last beta release, sorry.

					Jordan

pam@hpiacla.HP.COM (Pam Munsch) (05/28/88)

Can anyone tell me how to figure out the current state (icon or normal) of an 
X Toolkit window (ie. TopLevel Shell widget) or an X window?


Thank you.

Pam Munsch
Industrial Applications Center
Hewlett-Packard

vet@anumb.UUCP (V.E.Tavernini) (06/30/88)

I want to be able to make topLevelShells, created using 
XtCreateApplicationShell (and the one originally returned by
XtInitialize), visible and invisible at will.  I've tried using
XtMapWidget/XtUnmapWidget and XtManageChildren/XtUnmanageChildren in
different combinations (and with and w/o the window manager working),
but they don't seem to work.  XtUnmapWidget makes the topLevelShell
go away but it doesn't get reappear with I call XtMapWidget or
XtManageChildren.  XtUnmanageChildren doesn't seem to do anything,
which is odd since it supposedly calls XtUnmapWidget.

Any help would be appreciated...

Thanks,

Victor Tavernini
ihnp4!mvuxi!vet

AT&T Bell Labs
Andover, MA