Theoretical Programmers Wanted [message #36589] |
Tue, 07 October 2003 17:55  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Hi Folks,
Here is one for all you theoretical programmers out there.
I have a simple test program. Call it TEST1. Here it is.
PRO Test1_Event, event
Widget_Control, event.top, Get_UValue=label
FOR j=0,49 DO BEGIN
Widget_Control, label, Set_Value=String(j,format='(I3.3)')
Wait, 0.1
ENDFOR
Widget_Control, event.top, /Destroy
END
PRO Test1
tlb = Widget_Base(Column=1, XOffset=200, YOffset=100)
label = Widget_Label(tlb, Value='000', XSize=100, /Align_Center)
button = Widget_Button(tlb, Value='Start Program')
Widget_Control, tlb, /Realize, Set_UValue=label
XManager, 'test1', tlb, /No_Block
END
When you run it, a graphical user interface appears, you click
the "Start Program" button and the label counts up to 49. Perfect!
Now you make a save file out of it:
IDL> .compile test1
IDL> Resolve_All
IDL> Save, File='test1.sav', /Routines
Quit IDL and double click the save file. Still runs like a champ!
Now, here is another file, very similar to the first.
PRO Test2
tlb = Widget_Base(Column=1, XOffset=200, YOffset=100)
label = Widget_Label(tlb, Value='000', XSize=100, /Align_Center)
Widget_Control, tlb, /Realize, Set_UValue=label
XManager, 'test2', tlb, /No_Block
FOR j=0,49 DO BEGIN
Widget_Control, label, Set_Value=String(j,format='(I3.3)')
Wait, 0.1
ENDFOR
Widget_Control, tlb, /Destroy
END
When you run it, a graphical user interface appears and the
label counts up to 49. Perfect! But now you make a save file
out of this:
IDL> .compile test2
IDL> Resolve_All
IDL> Save, File='test2.sav', /Routines
When you quit IDL and double click the save file, you get
the label appearing in the top-level base, but no count up
on the label. It stays stuck at 000. :-(
Here's my theoretical question: Why?
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Theoretical Programmers Wanted [message #36704 is a reply to message #36589] |
Tue, 14 October 2003 08:50  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Oliver Thilmann writes:
> Yup - ran into the same problem myself some time ago.
> /just_reg is the option of choice, is it? :-)
As it happens, if I had just written the program the
way I *thought* I had written the program, a great deal
of confusion would have been avoided. :-(
There is still a question of how to write blocking/modal
dialogs in run-time IDL (especially those NOT called from
widget programs), but I'll leave it for a time when I
feel less embarrassed about life in general. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
|
Re: Theoretical Programmers Wanted [message #36710 is a reply to message #36589] |
Mon, 13 October 2003 23:05  |
alt
Messages: 28 Registered: August 2001
|
Junior Member |
|
|
>
> Here's my theoretical question: Why?
>
This is a help fragment from XMANAGER topic about NO_BLOCK keyword:
Note - NO_BLOCK is ignored by IDL Runtime. If a main procedure uses
XMANAGER with the NO_BLOCK keyword set, IDL Runtime defers subsequent
processing of the commands following the XMANAGER call until the
widget associated with the call to XMANAGER is destroyed.
I am just ran into the same situation some time ago.
Best regards,
Altyntsev Dmitriy
|
|
|