[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q: Xmanager explanation?

"David L. Keller" wrote:
> Using IDL in two different projects about 10 years apart,
> I have yet to figure out what 'Xmanager' does for me.
> I realize that I have to keep track of widget ids, which
> I do by creating a common array of NAME and ID pairs:
>      a = {nameandnumber, wnam : "", wnum : 0L}
> I call a simple routine to add to the list of widgets:
>      add2namenumber,'DataMenu',data_menu_id
> To retrieve a widget id, I have a function 'wnum' that
> converts the NAME to the NUMBER (ID):
>      widget_control,wnum('DataMenu'),blah, etc=andSoOn)
> I am more comfortable going through this effort myself,
> because I -dont- know what xmanager does for me.  Ok, I
> do know that it keeps track of the widget id's, but as
> I say, I'd rather do it myself and understand it.
> I also don't trust Xmanager in that I am not sure that
> I can trust it with the 'interrupt' magic, and type IDL
> commands at the same time.
> Anyone able to clearly explain what I get with xmanager?
> What it's drawbacks might be?
> -- Dave --

The code to XManager is available in the lib subdirectory of your IDL
distribution, and is pretty straightforward.  If it weren't for all the
BLOCKING/NON-BLOCKING and outdated MODAL functionality, XManager would simply be
calling widget_event for all managed widgets.  For fun, try making a copy of
xmanager.pro, modifying it to print some diagnostics inside the event loops, and
letting it run.

A little experimentation will reveal that in almost no cases nowadays does
XManager actually *do* anything.  The "command line", i.e. something hard coded
into IDL, now dispatches and handles most of the events.  For traditional
"blocking" applications (those without NO_BLOCK set), widget_event is called
once with a special keyword, and only returns when nothings remains to generate
events... i.e all of the work is done in widget_event, which each call to
XManager in an application invokes once.  Only the FAKE_MODAL event loop
actually does any work, but it is seldom used, since you get the:

% XMANAGER: The MODAL keyword to the XMANAGER procedure is obsolete. It is
  superseded by the MODAL keyword to the WIDGET_BASE function.

warning every time.  So, as you can see, with NONBLOCKING widgets upon us, more
and more of the event handling code has moved away from XManager.


 J.D. Smith                             |*|      WORK: (607) 255-5842    
 Cornell University Dept. of Astronomy  |*|            (607) 255-6263
 304 Space Sciences Bldg.               |*|       FAX: (607) 255-5875 
 Ithaca, NY 14853                       |*|