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

Home » Public Forums » archive » pointers 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: Pointers [message #16658 is a reply to message #8813] Mon, 09 August 1999 00:00 Go to previous messageGo to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
RLeejoice wrote:
> Been using IDL for a year. Want to expand into what I feel are three last
> topics of interest; pointers, widgets, and object graphics.
>
> I've read the entire pointer section of the help file and have the following
> question:
>
> What are pointers used for in IDL. I only precieve that they lead to the new
> object paradyme. Is this correct? I use structures in most of my programming
> and pass the complete structure to the appropaite procedures. I suppose I
> could creat a pointer to a structure, but since IDL passes structures by
> reference, what is the need?

There are at least two cases I know of where pointers are indispensable:

(1) When the size and/or type of an item contained in a structure is not
known until runtime (you cannot change the size or type of a variable in
a structure). For example, say you have a widget program with a large
information structure. At some point in the widget program, you want to
be able to select sub-regions of an image and store the data from the
selected regions (e.g. to save it to file elsewhere in the program). The
most convenient way to save this data in the information structure is to
use an array of pointers, where each pointer in the array points to the
data for each selected region.

(2) When you wish to return information from a dying widget. If you want
a widget program to return an item of information, then it must be
passed in a variable which has global scope. A pointer is the most
convenient way to pass this kind of information. The method is
- Create the information structure,
- Store the information structure using a pointer,
- Store the pointer in the user value of the widget top level base,
- Invoke XMANAGER to handle widget events with the CLEANUP keyword set
to the name of the routine to be called when the top level widget dies,
- In the cleanup routine, save whatever information is required via the
pointer,
- After XMANAGER is done, retrieve the information from the pointer.

Cheers,
Liam.

--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Realizing a widget only once
Next Topic: reading pixels from images from automated XYpositions

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

Current Time: Sat Oct 11 17:26:17 PDT 2025

Total time taken to generate the page: 0.88305 seconds