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

Home » Public Forums » archive » Dereferencing a large array in a structure
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: Dereferencing a large array in a structure [message #50368 is a reply to message #50301] Wed, 27 September 2006 11:17 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Wed, 27 Sep 2006 05:43:06 -0700, greg michael wrote:


> In my widget programs, I settled for the option of putting everything
> into a single state variable, s - a sometimes huge structure containing
> all kinds of stuff, and frequently pointers to variable-sized or large
> items, which gets passed around via the tlb uvalue (extract and set it
> as the first and last things in the event handler). Then nearly every
> routine passes s as its first parameter. Seems to me much cleaner than
> using common blocks. In all other widget uvalues, I pass only its name
> (e.g. 'tab3.some_button'), and where necessary decompose that to call
> the right routine.

You've basically re-implemented parts of the object framework which exist
in IDL already. In that case, a special variable "self" gets passed to
all class methods magically, by reference. This is IMO by far the nicest
way to do GUI programming.

The only trick is getting XManager or WIDGET_EVENT to pass events to the
object methods (normally they only like plain routines). The trick is
simple and has been well documented: just save "self", the object
reference, in the TLB UVALUE, and use a tiny glue procedure like this as
the EVENT_PRO:

pro myclass_event,ev
widget_control,ev.top,GET_UVALUE=self
self->Event,ev
end

On a related note, shouldn't XManager and the event processing in IDL be
modified to remove this hack? Shouldn't we be able to tell XManager "Pass
events from this widget heirarchy to method foo of object boo", with bonus
points for allowing the object/method to change during runtime (similar to
how widget_control,b,EVENT_PRO= can already be used to change the callback
routine). This is a simple modification. A better method might be a new
XMANAGER class, from which objects can inherit to gain all manner of
(extensible) event processing functionality.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Does object graphics have true-color?
Next Topic: Closing out of GUI window

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

Current Time: Sat Oct 11 00:56:57 PDT 2025

Total time taken to generate the page: 0.63805 seconds