dheller@cory.Berkeley.EDU.UUCP (06/03/88)
I posted a similar note a while ago and no one followed up or responded to me personally, so let me simplify the question a little bit. I want to write an application which opens some windows in which I manage everything about them --their contents, events, gc's, etc... There is quite a bit of blitting of my own XImage's and the like. But I also want to be able to open dialog boxes that contain widget trees of scrollbars, text widgets and command widgets. I don't really care about the dialog box except for functionality (thus, the use of widgets), however, in order to do this, I have to call XtInitialize() (which means that I can NOT have widgets inside of a window I create on my own -- so much for having a "panel" within a window I've already created). Ok, so I accept that the widgets have their own window to play with, but I can't call XtMainLoop() unless I fork() and that not only wastes too much resources, but is tough to manage (if the man program exits, I can't get the widgets to die unless I have that process exit() too). I tried not forking and not calling XtMainLoop() and having my own main loop use XNextEvent() and read events for both my window and the widgets window (I don't know why, but it doesn't seem to work). If I don't call XtMainLoop(), the dialog box (widget tree) never gets displayed -- I also can't seem to get events from it. The bottom line is: if you use widgets, can you ONLY use widgets and no more CreateWindow's? Dan Heller <island!argv@sun.com>
swick@ATHENA.MIT.EDU (Ralph R. Swick) (06/03/88)
Date: 2 Jun 88 23:12:14 GMT From: pasteur!cory.Berkeley.EDU!dheller@AMES.ARC.NASA.GOV (Dan Heller) ... I tried ... having my own main loop use XNextEvent() and read events for both my window and the widgets window (I don't know why, but it doesn't seem to work). You should be using XtNextEvent and dispatching all events to Xt through XtDispatchEvent (because Xt is interested in certain events regardless of the source window). After the XtDispatchEvent, you can then check to see if the event was really for one of your non-widget windows. ... The bottom line is: if you use widgets, can you ONLY use widgets and no more CreateWindow's? The intent of the design is to allow mix-and-match when necessary. We acknowledge that the rules for doing so need to be described in more detail.
diamant@hpfclp.SDE.HP.COM (John Diamant) (06/04/88)
> I tried not forking and not calling XtMainLoop() and having my own > main loop use XNextEvent() and read events for both my window and > the widgets window (I don't know why, but it doesn't seem to work). > If I don't call XtMainLoop(), the dialog box (widget tree) never > gets displayed -- I also can't seem to get events from it. XtMainLoop() is a very simple function. It calls XtNextEvent and XtDispatchEvent in an infinite loop. You could make your own variant that dispatches your own events first, but calls XtDispatchEvent on the remaining Toolkit events. John Diamant Software Development Environments Hewlett-Packard Co. ARPA Internet: diamant@hpfclp.sde.hp.com Fort Collins, CO UUCP: {hplabs,hpfcla}!hpfclp!diamant