Re: How to Acces heap object. [message #35219] |
Tue, 27 May 2003 12:43 |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.193d023fdad41056989bb1@news.frii.com...
> Miguel writes:
>
>> Ok, my procedure is only an example, I know I can return the
>> value with a function. But I want to acces to the variable oMsgCat object
>> as a global variable.
>
> If you want it to be global, you have two choices.
> Make it a system variable (DEFSYSV), or put it in
> a common block.
If you've lost a reference to an heap variable you can retrieve it with the
OBJ_VALID and PTR_VALID functions. When called with no arguments, they
return a list of all valid object/pointer heap variables. They both also
support a CAST keyword, which you can use to track down objects/pointers
given the ouput of the HELP command.
Another possibiility: if you have a GUI object, build a facility into the
code that will tell you its object reference.
But perhaps you should tell us more about what you are *really* trying to
do.
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|
Re: How to Acces heap object. [message #35227 is a reply to message #35219] |
Tue, 27 May 2003 05:04  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Miguel writes:
> Ok, my procedure is only an example, I know I can return the
> value with a function. But I want to acces to the variable oMsgCat object
> as a global variable.
>
> Any Ideas?
If you want it to be global, you have two choices.
Make it a system variable (DEFSYSV), or put it in
a common block.
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: How to Acces heap object. [message #35228 is a reply to message #35227] |
Mon, 26 May 2003 23:11  |
user
Messages: 8 Registered: August 1999
|
Junior Member |
|
|
Ok, my procedure is only an example, I know I can return the
value with a function. But I want to acces to the variable oMsgCat object
as a global variable.
Any Ideas?
--
Miguel Angel Cordoba
Craig Markwardt wrote:
> user@domain.invalid writes:
>
>
>> I create this procedure
>>
>> PRO open_lang,path,fitxer_catalog
>> oMsgCat=MSG_CAT_OPEN('',FILENAME=path+fitxer_catalog)
>> END
>>
>> and I call with the next command
>>
>>
>>
> ... snip ...
>
>
>> <ObjHeapVar19> STRUCT = -> IDLFFLANGUAGECAT Array[1]
>>
>> How can I acces to this object heap variable?.
>>
>>
>
> Your problem is not to access a heap variable, but rather to return
> the value from OPEN_LANG. You can do that by turning it into a
> function:
>
> FUNCTION open_lang,path,fitxer_catalog
> oMsgCat=MSG_CAT_OPEN('',FILENAME=path+fitxer_catalog)
> return, oMsgCat
> END
>
> And then calling it:
> mycat = open_lang('/lang/', 'msg.cat')
>
>
> Good luck,
> Craig
>
>
>
>
--
---------------------------------------------------------
Miguel Angel Cordoba mailto:cordoba@grahi.upc.es
TEL. 93 4017371
http://campus.uab.es/~2034008
Grup de Recerca Aplicada en Hidrometeorologia (GRAHi-UPC)
http://www.grahi.upc.es
---------------------------------------------------------
|
|
|
Re: How to Acces heap object. [message #35231 is a reply to message #35228] |
Mon, 26 May 2003 08:39  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
user@domain.invalid writes:
>
> I create this procedure
>
> PRO open_lang,path,fitxer_catalog
> oMsgCat=MSG_CAT_OPEN('',FILENAME=path+fitxer_catalog)
> END
>
> and I call with the next command
>
... snip ...
>
> <ObjHeapVar19> STRUCT = -> IDLFFLANGUAGECAT Array[1]
>
> How can I acces to this object heap variable?.
Your problem is not to access a heap variable, but rather to return
the value from OPEN_LANG. You can do that by turning it into a
function:
FUNCTION open_lang,path,fitxer_catalog
oMsgCat=MSG_CAT_OPEN('',FILENAME=path+fitxer_catalog)
return, oMsgCat
END
And then calling it:
mycat = open_lang('/lang/', 'msg.cat')
Good luck,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|