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

Home » Public Forums » archive » Objects and Widgets
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: objects and widgets [message #49236 is a reply to message #19933] Wed, 05 July 2006 06:21 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
gnarloo@libero.it wrote:
> Dear all, I havent been around for pretty a long time, anyway, hope you
> all are doing fine.
> Imagine a program with a gui interface and callback procedures.
> i am writing the callback procedures, (basically the core of the
> program) but one thing occurs. I am using objects (self made, i wrote
> structures and methods) and i create them with obj_new at the '
> beginning' of my program, that is, i create the objects in the realize
> callback procedure of the base_0 widget. when I try to use the objects
> i have created in another unit program, for example a mouse button
> procedure, the object appears as undefined. I know for sure that the
> object was created but it appears that it doesnt have global scope. can
> anyone help? thanx to all in advance.
>

Hi,

While objects are persistent heap variables they really don't have the
global scope you re assuming they do. You still have to tuck a reference
to the object somewhere handy in you program. Your best bet is to store
a reference to your objects in the UVALUE of the widget generating the
event. I like to store both the object reference and the method that I
want to call when the event occurs.

myWidgetID = WIDGET_SOMETHING(parent, ...., $
UVALUE = {OBJECT:myObjectReference, METHOD: "MethodForHandlingEvent"})


In the event callback access the the UVALUE that contains the reference
using (very simple example) ....

PRO MYEVENT, ev
WIDGET_CONTROL, ev.ID, get_Uvalue = myInfo
CALL_METHOD, myInfo.method, myInfo.object, ev
END


On the ATTVIS user contribution website there are some generic
object-associated event handlers written by Jim Pendelton that give you
more details. As always, check out David Fanning's very detailed
resources on this subject.

Cheers,
Ben
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Avoid loop in matrix operation
Next Topic: reading data from file

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

Current Time: Thu Oct 09 23:07:49 PDT 2025

Total time taken to generate the page: 0.80212 seconds