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

Home » Public Forums » archive » Re: globalization of variables
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: globalization of variables [message #51221 is a reply to message #51220] Mon, 06 November 2006 06:45 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sven Ohmann writes:

> in the code below I want to use the variable voxel_a0 globally. That
> means, when I try after compilation (successful) to run the program I
> got the message:
>
> variable is undefined : voxel_a0
>
> In principle I want that after starting the program after pressing the
> 'apply_button' (eventhandler=3Dapplydata_event) the variables should be
> stored globally in the structure pState, so that when proceeding the
> program in the subprogram efgalc1_computedim I want to use them again,
> and later on in other functions or subprograms as well. Any idea ?


The variable isn't created yet when you are storing it
in your state pointer. It is only created *after* the
program runs. So, when you create the state pointer you
have to put "dummy" data there to hold the place for the
real data to be stored there later.

I typically store something there that I would recognize
as "not filled yet". For integers this might be the
number -999, for example. For floating point numbers is might
be !Values.F_NAN. If you have a pointer field
that you don't *know* how to fill, or if what you are
going to fill it with will vary in size or type, then,
of course, you "hold the space" with a null pointer.

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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: error reading file question
Next Topic: Re: [OT] Re: IDL Segmentation Fault

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

Current Time: Wed Oct 08 17:33:31 PDT 2025

Total time taken to generate the page: 0.00404 seconds