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

Home » Public Forums » archive » Re: Problem with INFO definition
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Problem with INFO definition [message #45163] Wed, 17 August 2005 06:02
pravesh.subramanian is currently offline  pravesh.subramanian
Messages: 21
Registered: August 2005
Junior Member
Thanks for that one!
Re: Problem with INFO definition [message #45173 is a reply to message #45163] Tue, 16 August 2005 13:36 Go to previous message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <MPG.1d6bc53c159e72a8989a43@news.frii.com>,
David Fanning <davidf@dfanning.com> wrote:

>> again, how do i append data
>> to an existing file ?
>
> Open the file with OPENU.
>
> Cheers,
>
> David

Or better yet, open a *copy* of the file with OPENU. :-)

Ken
Re: Problem with INFO definition [message #45174 is a reply to message #45173] Tue, 16 August 2005 09:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Pravesh writes:

> Thats right! U have spoken about it in your book.
> Thanks for the info...
> Do u think that exporting formatted data to excel sheets is a good
> idea? I have tried it and it does look ok..

No, I think exporting data to an Excel spreadsheet is
a sacrilege. :-)

> again, how do i append data
> to an existing file ?

Open the file with OPENU.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Problem with INFO definition [message #45175 is a reply to message #45174] Tue, 16 August 2005 09:05 Go to previous message
pravesh.subramanian is currently offline  pravesh.subramanian
Messages: 21
Registered: August 2005
Junior Member
Hi David,

Thats right! U have spoken about it in your book.
Thanks for the info...
Do u think that exporting formatted data to excel sheets is a good
idea? I have tried it and it does look ok.. again, how do i append data
to an existing file ?

Pravesh
Re: Problem with INFO definition [message #45176 is a reply to message #45175] Tue, 16 August 2005 08:57 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
pravesh.subramanian@gmail.com writes:

> I am a big fan of David's book and I like the way Info structure has
> been used. I use the same method to handle data to be passed around.
> In one of my Event handler proc, I am returned a 1-d array which I
> would like to put in Info.
> Since I do not know the size of this array, how is it possible to
> define this 1-d array in the INFO structure in the Widget Def. Module?
>
> currently, I do something like this...
>
> 1-d = bytarr(32000)
> ...
>
> info = { $
> ......
> 1-d: 1-d $
> }
>
> I really donno what size this array could take (anything between 0 and
> 32000).
> Is there a way to define this element in the event handler and not the
> WDM? What if the size of this array is not fixed (say the 32000 factor
> is not available).

Anytime you have information in the info or state structure
and you don't know how big it is, or the size might be changing,
you use a pointer to store it. This doesn't change the size
of the info structure, and allows you to redefine your data
at will.

info = { $
....
data: Ptr_New(), $
}

When you go to fill it up:

IF Ptr_Valid(info.data) THEN $
*info.data = data ELSE info.data = Ptr_New(data)

Of course, you need to free the pointer in the CLEANUP
method of the widget program, so you don't leak memory
when your widget program is destroyed.

Cheers,

David

P.S. I thought this was explained pretty well in that
darn book. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Install ENVI/IDL on cygwin
Next Topic: Re: Como unir la interfaz garfica con los procedimientos

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

Current Time: Wed Oct 08 20:00:57 PDT 2025

Total time taken to generate the page: 0.01103 seconds