| Re: Can I do this with call_procedure/call_function, or do I have to use execute? [message #50200] |
Mon, 18 September 2006 14:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Braedley writes:
> I posted this recently in IDL only group, but to no avail, so I'll try
> here now.
Yeah, the Interface Definition Language people don't know squat
about IDL. :-)
> In a widget program, I have a pseudo command line. When an event is
> triggered for this command line, the contents of the line are passed to
> the handler (obviously as a string). That string may contain something
> like:
>
> print, f_samp
>
> in which case, I would like the program to display the value for f_samp
> in an output text widget, much the same way that entering the same
> command into the IDLDE command line prints the value to the command
> output window. The code to do this with execute is fairly easy,
> namely:
>
> executed=execute('widget_control, output_text_widget, $
> /append, set_value=' + commands[1], 0, 0)
>
> where commands is the value returned after performing strsplit on the
> input string with space and comma delimiters (in this case, f_samp).
> What I'm wondering is, since I want this particular piece of code to
> run on a computer with only a copy of the virtual machine installed,
> can I acomplish the same feat with only using call_procedure and or
> call_function?
>
> As a side note, the following will not work:
>
> call_procedure, 'widget_control', output_text_widget, $
> /append, set_value=commands[1]
>
> That will just print f_samp, not the value of f_samp.
You are going to have to obtain the *value* of the variable,
as you realize. To do that, you are going to have to learn
about SCOPE_VARFETCH and SCOPE_VARNAME. Here is an article
that might help:
http://www.dfanning.com/tips/access_main_vars.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
| Re: Can I do this with call_procedure/call_function, or do I have to use execute? [message #50291 is a reply to message #50200] |
Tue, 19 September 2006 04:56  |
Braedley
Messages: 57 Registered: September 2006
|
Member |
|
|
David Fanning wrote:
> Braedley writes:
>
>> I posted this recently in IDL only group, but to no avail, so I'll try
>> here now.
>
> Yeah, the Interface Definition Language people don't know squat
> about IDL. :-)
Oops, my bad.
>> In a widget program, I have a pseudo command line. When an event is
>> triggered for this command line, the contents of the line are passed to
>> the handler (obviously as a string). That string may contain something
>> like:
>>
>> print, f_samp
>>
>> in which case, I would like the program to display the value for f_samp
>> in an output text widget, much the same way that entering the same
>> command into the IDLDE command line prints the value to the command
>> output window. The code to do this with execute is fairly easy,
>> namely:
>>
>> executed=execute('widget_control, output_text_widget, $
>> /append, set_value=' + commands[1], 0, 0)
>>
>> where commands is the value returned after performing strsplit on the
>> input string with space and comma delimiters (in this case, f_samp).
>> What I'm wondering is, since I want this particular piece of code to
>> run on a computer with only a copy of the virtual machine installed,
>> can I acomplish the same feat with only using call_procedure and or
>> call_function?
>>
>> As a side note, the following will not work:
>>
>> call_procedure, 'widget_control', output_text_widget, $
>> /append, set_value=commands[1]
>>
>> That will just print f_samp, not the value of f_samp.
>
> You are going to have to obtain the *value* of the variable,
> as you realize. To do that, you are going to have to learn
> about SCOPE_VARFETCH and SCOPE_VARNAME. Here is an article
> that might help:
>
> http://www.dfanning.com/tips/access_main_vars.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks for the tip. Works just the way I want it to.
Braedley
|
|
|
|