comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: global variables in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: global variables in IDL [message #28649 is a reply to message #28648] Wed, 26 December 2001 17:02 Go to previous messageGo to previous message
Gert is currently offline  Gert
Messages: 11
Registered: December 2001
Junior Member
David,

thanks for the tip - I could off course do it this way, but then i need to
pass the pointer around to anyone who might need it. What i wanted to is

pro Widgetpro,

widgetID = getIDofGlobalswidget
WIDGET_CONTROL, widgetID , GET_UVALUE=sGlobals, /NO_COPY

print, sGlobal.threshold

...
end

is this possible? How can I do the 'getIDofGlobalswidget'?

Gert





"David Fanning" <david@dfanning.com> wrote in message
news:MPG.16926460c37f95ec9897bb@news.frii.com...
> Gert (gert.van.de.wouwer@NO_SPAMpandora.be) writes:
>
>> I want to keep some global variables in an IDL program containing
different
>> widgets without having to pass the variables each time a new base widget
is
>> created. It can be done with common blocks, but then you can have only 1
>> instance of the program running.
>> I was thinking of creating a widget (called Globals) and copy the
variables
>> in a struct to its uvalue. If another widget then wants these variables,
I
>> need to get a widget identifier to Globals and retrieve the struct. But
how
>> can I get this widget identifier?
>
> It's odd, isn't it, how good ideas keep being rediscovered
> over and over again. :-)
>
> It sounds like what you need is, uh, a pointer!
>
> IDL> info = Ptr_New({all_your_stuff_in_here}, /No_Copy)
>
> Then, when you create your widgets, you simply
> pass the pointer to each program that needs it:
>
> IDL> widget_program_1, info
> IDL> widget_program_2, info
> IDL> widget_program_3, info
>
> The syntax of using pointers to structures is a little
> weird until you get used to it:
>
> TV, (*info).image, Order=(*info).order
>
> Alternatively, you can create your pointer in the first
> widget program, and pass it to the other programs that
> are called from the first, etc. There are lots of ways
> to do it, but all rely on a pointer of some sort.
>
> Cheers,
>
> David
>
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting
> 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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Gridding Gui
Next Topic: Inverting the image

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:28:12 PDT 2025

Total time taken to generate the page: 0.00394 seconds