Re: object reference in a structure [message #12890 is a reply to message #12857] |
Tue, 15 September 1998 00:00  |
Phillip & Suzanne
Messages: 31 Registered: June 1998
|
Member |
|
|
Charlie Solomon wrote:
;> Hi everyone...is it possible to put an object reference in a structure
;> variable? For example, I create a new object, then create a pointer to an
;> info structure for my widget and try to include the object reference in the
;> structure:
;> junk = 'charlie was here'
;> ptr_new, info( { junk:junk, oWindow:0 } )
Try this:
junk='charlie was here'
ptr_new, info({junk:junk, oWindow:Obj_New()} )
;> But when I try to access it bad things happen (I can get the actual error
;> message if needed). Here's how I try to access it:
;> (*info).oWindow = obj_new('IDLgrWindow') ;no worky
;> (*info).oWindow -> method, keywords ;no worky
;> Should I even be trying this? I want to be able to store the object
;> reference in info after it is created in another procedure and passed back
;> so that my widget program can modify properties and destroy it based on
;> xmanager events. Thanks!
The problem really turns out to be one of data types. An IDL object reference
is not a short integer. I believe it is a long integer, but Obj_New() returns
a null object reference that is definitely the correct type. Once this is set
up, I believe you'll be in great shape.
Phillip
|
|
|