[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

1422.0. "Message Window Help" by ASD::STRAIGHT () Tue Sep 12 1989 09:34

I'm new to DECwindows and trying to 'quickly' put a prototype together. 
I've looked quickly through the notes file but could not find what I
needed, so sorry if this is redundant.

My question has to do with a message window.  I have a message window 
that is a list box. I want to keep looping and reading the messages
sent to a mailbox and displaying them in the list box.  This process 
should continue until the user selects the 'quit' button on the menu bar.
The problem/question I have is how to test for the mouse click that 
indicates the quit button was selected.  Is there some default to test 
the mouse click that I could include in an AST and have an event flag work 
off it?  Any other suggestions?


Thanks in advance.

T.RTitleUserPersonal
Name
DateLines
1422.1The Session Manager does it...CADSE::STRAIGHTRob StraightMon Sep 18 1989 12:3527
    The software being written is similar in function to the Session
    Manager.  It has a menu bar that is always active (which implies
    XTMainLoop has been called), and it is also able to receive
    asynchronous messages from a number of applications.  Can anyone
    shed some light on how this works?
    
    This is what's been tried:
    -create a mailbox to receive messages
    -issue a QIO to read the mailbox.  An AST routine will be called when
     the read is complete
    -setup the menu (consisting of "start" and "quit"), and call XTMainLoop
    
    -when a message arrives in the mailbox, the AST routine gets called. 
     It displays the message in the list box, and then issues another
     QIO to read the next message (using the same AST routine).
    
    Currently this is implemented, but it access violates in the AST
    routine, probably at the point where the DwtListBoxAddItem routine
    is called (the debugger gets lost, unfortunatly).
    
    Does anyone know if this method of using AST's to get out of the
    XTMainLoop should work?  Or any alternative suggestions to solving
    the problem?  Maybe a pointer to the owner (or source) of the
    Session Manager?
    
    Thanks!!

1422.2AITG::DERAMODaniel V. {AITG,ZFC}:: D'EramoMon Sep 18 1989 16:518
>>    Currently this is implemented, but it access violates in the AST
>>    routine, probably at the point where the DwtListBoxAddItem routine
>>    is called (the debugger gets lost, unfortunatly).

	You can't call toolkit routines at AST level.

	Dan

1422.3Replace XtMainLoop?CADSE::STRAIGHTRob StraightMon Sep 18 1989 17:4516
    Ok, how about if I replace the XtMainLoop call with the next and
    dispatch event calls?  There's also an appl_pending call that could
    be used to keep the whole thing from blocking while waiting for input?
    
    Something like:
    
    if XtApplPending(application_context) > 0
    then
      XtApplNextEvent(application_context,event)
      XtDispatchEvent(event)
    endif
    
    Does this seem workable?
    
    	Rob

1422.4...more...GSRC::WESTVaribles don't, Constants aren'tMon Sep 18 1989 18:0514
  If you are using XtInitialize then the XtApp* calls are not necessary.  Just
use XtPending, XtNextEvent and XtDispatchEvent.

  After the XtDispatchEvent call you could do your own processing...this however
is considered bad programming.  If you were to do it this way it has been said
that you must process events at least every 1/4 second.

  The recommended way is to use work procedures.  There are numerous notes on
this subject in this and other related conferences.

					-=> Jim <=-


1422.5add input for async io eventsCSC32::B_WACKERMon Sep 18 1989 18:133
Also, instead of AST, use ADD INPUT to generate a callback to handle 
the io.

1422.6PSW::WINALSKICareful with that VAX, EugeneMon Sep 18 1989 19:2212
You can use ASTs to receive the asynchronous events, post them to data
structures where the main, synchronous part of your application can find them,
and then use XtPending() and XtNextEvent() to do X event dispatching,
interspersed with your own processing.  The only catch is that you must check
for and dispatch X events on a timely basis (the 1/4 second rule).  VMS
Mandelbrot is an example of an application that does this.  It also illustrates
the use of client messages sent from AST routines to "unstick" the application
when it's waiting in XtNextEvent().  Look at modules M_DISPLAY.C AND WIDGETS.C
in TLE::ULNK$:[WINALSKI.MANDELBROT.V41_SOURCE].

--PSW