Re: xwindow and ps_form questions [message #14035 is a reply to message #14032] |
Tue, 19 January 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Brad Gom (gombg@uleth.ca) writes:
> I've been trying to add a xwindow widget to my widget program. I have
> two problems:
>
> 1) when I use xwindow within a widget program (ie I call xwindow to run
> a plot routine
> when a certain widget event occurs) the plot works fine. I can
> resize properly.
> (xwindow works perfectly when I call it from a non-widget program)
> But, when I try to configure a postscript file for output, I get the
> following error:
>
>> % XMANAGER: Caught unexpected error from client application. Message follows...
>> % Variable is undefined: CANCEL.
>>
> It seems that the main xwindow routine is not waiting for the
> ps_form routine to return its structure. The
> error occurs on this line in xwindow:
>
>> PRO XWINDOW_CONFIGURE_FILES, event
>> WIDGET_CONTROL, event.top, GET_UVALUE=info, /NO_COPY
>> ; What kind of file to configure?
>> WIDGET_CONTROL, event.id, GET_VALUE=whichFile
>> CASE whichFile OF
>> 'Configure PostScript File...': BEGIN
>> newkeywords = PS_FORM(DEFAULTS=info.ps, $
>> LocalDefaults=info.pslocal, Cancel=cancel, Create=create)
>> IF NOT cancel THEN info.ps = newkeywords
>>
> What special precautions do I need to take when including xwindow
> in a widget program?
None. Download the latest versions of both programs. When IDL
changed the Modal behavior in IDL 5, I had to update the way
the program behaved. The proper call in the latest version of
XWindow is this:
'Configure PostScript File...': BEGIN
newkeywords = PS_FORM(DEFAULTS=info.ps, Parent=event.top, $
LocalDefaults=info.pslocal, Cancel=cancel, Create=create)
Where the PARENT keyword is used to pass a group leader to the PS_FORM
top-level base. A group leader is *required* to create a proper modal
widget.
You can get the latest versions here:
http://www.dfanning.com/programs/xwindow.pro
http://www.dfanning.com/programs/ps_form.pro
> 2) I want to register the xwindow when I create the main widget
> hierarchy. How do I plot to the
> existing xwindow, and retain the ability to resize and output?
This is a good idea to want to plot to the existing XWindow, but
the program was never designed with that requirement in mind. In fact,
what I specifically had in mind was to write a program that would
serve as an model for how you could write a resizeable window
for *your* program requirements.
If you really want to plot into the existing XWindow, then I suggest
you re-write the guts of XWindow as an object. It wouldn't take more than
a couple of hours, I think. I'll leave it as a programming exercise for
the user. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Note: This follow-up was e-mailed to the cited author.]
|
|
|