Re: Q: Xmanager explanation? [message #18217] |
Thu, 09 December 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Mirko Vukovic (mvukovic@taz.telusa.com) writes:
> Two years ago, I made the mistake of publicly announcing that I did not
> use Xmanager. The next thing that hit me Dave Fanning's book,
> unsolicited ! :-). I read with it with pleasure, and off course paid
> up.
>
> So, be carefull with what you say.
Shhhuuushh, Mirko. You are giving away one of my
best gorilla marketing tips! If this gets out, Lord
knows there will be no end of people admitting their
dumb programming practices. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
|
Re: Q: Xmanager explanation? [message #18240 is a reply to message #18217] |
Wed, 08 December 1999 00:00  |
J.D. Smith
Messages: 214 Registered: August 1996
|
Senior Member |
|
|
"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.
JD
--
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 |*|
|
|
|
Re: Q: Xmanager explanation? [message #18245 is a reply to message #18240] |
Wed, 08 December 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
David L. Keller (davekeller@pop.omah.uswest.net) writes:
> 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.
>
> Anyone able to clearly explain what I get with xmanager?
> What it's drawbacks might be?
I'm trying to be serious here, but all I can think
of are wisecracks this morning. :-(
Drawbacks!? There are no drawbacks to using XManager,
believe me. A widget program that doesn't use
XManager is is like going to the Rave with your
hair slicked back with Brylcreem. Let's just say
you chances of getting lucky are not too good.
XManager doesn't keep track of widget IDs, at
least not in any meaningful way that will help you
run your program. What it does keep track of is
which event should be sent to which event handler.
If you are still running IDL on your PDP-8 and you
like flipping those switches to program the darn
thing, then you will probably want to manage your
own events. But the rest of us use XManager to
take care of all this onerous work.
Your simple routine to keep track of widget IDs
and names is nice, but it's just so much easier
to use the built-in Find_By_UName keyword.
> 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.
What version of IDL did you say you were
running? IDL 1.5? Setting the NOBLOCK keyword
gives you access to any widget program you want to
run and access to the IDL command line at the same
time.
There are any number of well-written widget programs
around. I suggest you download a couple of them and
have a look at what you are missing. A lot has happened
in the 10 years you have been gone. :-)
Cheers,
David
P.S. OK, I get it. This guy is really Martin Schultz
just having a go at me for some fun I poked at him
in this newsgroup a while ago. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Q: Xmanager explanation? [message #18246 is a reply to message #18240] |
Wed, 08 December 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
David L. Keller (davekeller@pop.omah.uswest.net) writes:
>
> 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?
Uh, Dave. It's almost the millennium. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|