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

Home » Public Forums » archive » Structure in argument #2 -> With IDL ActiveX control
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
Structure in argument #2 -> With IDL ActiveX control [message #13641] Fri, 20 November 1998 00:00 Go to next message
Skiso is currently offline  Skiso
Messages: 5
Registered: August 1998
Junior Member
Hi,

Does the GetNamedData() function of the IDL ActiveX control support the
structure definition?

Example: MyVB_variable = IDLDrawWidget.GetNamedData("MyIDL_variable")

It doesn't seems to support the structure!

Skiso
Re: Structure in argument #2 -> With IDL ActiveX control [message #13758 is a reply to message #13641] Mon, 30 November 1998 00:00 Go to previous messageGo to next message
Matthew J. Sheats is currently offline  Matthew J. Sheats
Messages: 19
Registered: September 1997
Junior Member
> I'm working with IDL 5.1 and the most annoying bug is that my program that use IDL
> activeX run just one in Visual Basic. If I need to run again the program I need to close
> Visual Basic end re-open it. I hope this is fixed in 5.2!

Well, they actually *almost* fixed it in 5.1.1. But it turned out that
it had not been fixed afterall. Turns out, Visual Basic wasn't letting
go of it's IDL handles or something or other (not releaseing resources
or something) and that was causing the crash. 5.1.1 let you run a
couple times before crashing again.

5.2 seems to have fixed it, but I still get some odd behavior from now
and again. And I can prove that visual basic isn't "shutting down" IDL
each time I exit my sample program. I have a class that keeps track of
the number of times a certain member function is called, and between
runs, it doesn't reset. It doesn't crash out from underneath me
anymore, but sometimes when I am trying to gracefully exit VB, it gives
me some memory error and crashs.

Oh well, I guess baby steps are better than nothing.

Talk to you later,

Matthew Sheats
Los Alamos National Laboratory
Re: Structure in argument #2 -> With IDL ActiveX control [message #13762 is a reply to message #13641] Sun, 29 November 1998 00:00 Go to previous messageGo to next message
Skiso is currently offline  Skiso
Messages: 5
Registered: August 1998
Junior Member
"Matthew J. Sheats" wrote:

>> I understand that it is impossible to pass a entire structure from IDL to VB. But,
>> why can't I just pass the value of one field of a structure like this:
>>
>> Example: MyVB_variable = IDLDrawWidget.GetNamedData("MyIDL_structure.my_variable")
>>
>> It would be _very_ useful!
>
>> Skiso
>
> Oh agreed. That is annoying. I've always had to assign to some
> variable and then retrieve the data like:
>
> IDLDrawWidget.ExecuteStr( "x = MyIDL_structure.my_variable" )
> MyVB_Variable = IDLDrawWidget.GetNamedData( "x" )
>
> Definately seems to be a round about way of doing things. Funny thing
> is, I've seen similar behavior in places in IDL (not involving
> ActiveX). Like.. (and maybe this is just me being a moron), I can't do
> this:
>
> READU, Lun, Struct.X
>
> It doesn't seem to assign anything to Struct.X. What I always end up
> doing is something like this:
>
> READU, Lun, X
> Struct.X = X
>
> Pretty annoying. It's one of those things I never thought about
> reporting because I assumed it was a "feature" of some sort. One I
> could do without. Oh and ya, the structure and X and everything is
> defined prior to the READU.
>
> I have 3 activex related bugs still awaiting resolution right now.
>

I'm working with IDL 5.1 and the most annoying bug is that my program that use IDL
activeX run just one in Visual Basic. If I need to run again the program I need to close
Visual Basic end re-open it. I hope this is fixed in 5.2!

Skiso

> They didn't make it into 5.2, so now I have to wait at least until...
> what? 5.2.1? OH well.
>
> Welp, I've babbled long enough, ttyl8r.
>
> Matthew Sheats
> Los Alamos National Laboratory
Re: Structure in argument #2 -> With IDL ActiveX control [message #13763 is a reply to message #13641] Sat, 28 November 1998 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Matthew J. Sheats (sheats@lanl.gov) writes:

> Definately seems to be a round about way of doing things. Funny thing
> is, I've seen similar behavior in places in IDL (not involving
> ActiveX). Like.. (and maybe this is just me being a moron), I can't do
> this:
>
> READU, Lun, Struct.X
>
> It doesn't seem to assign anything to Struct.X. What I always end up
> doing is something like this:
>
> READU, Lun, X
> Struct.X = X
>
> Pretty annoying. It's one of those things I never thought about
> reporting because I assumed it was a "feature" of some sort. One I
> could do without. Oh and ya, the structure and X and everything is
> defined prior to the READU.

This is because structure de-references are passed into
procedures and functions (such as READU) by *value* and
not by *reference*. The *ONLY* thing passed into IDL by
reference are variables (whole variables, not parts of
variables).

Here is an article on my web page with more detailed
information:

http:///www.dfanning.com/tips/read_subscripted_array.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155

[Note: This follow-up was e-mailed to the cited author.]
Re: Structure in argument #2 -> With IDL ActiveX control [message #13765 is a reply to message #13641] Sat, 28 November 1998 00:00 Go to previous messageGo to next message
Matthew J. Sheats is currently offline  Matthew J. Sheats
Messages: 19
Registered: September 1997
Junior Member
> I understand that it is impossible to pass a entire structure from IDL to VB. But,
> why can't I just pass the value of one field of a structure like this:
>
> Example: MyVB_variable = IDLDrawWidget.GetNamedData("MyIDL_structure.my_variable")
>
> It would be _very_ useful!

> Skiso

Oh agreed. That is annoying. I've always had to assign to some
variable and then retrieve the data like:

IDLDrawWidget.ExecuteStr( "x = MyIDL_structure.my_variable" )
MyVB_Variable = IDLDrawWidget.GetNamedData( "x" )

Definately seems to be a round about way of doing things. Funny thing
is, I've seen similar behavior in places in IDL (not involving
ActiveX). Like.. (and maybe this is just me being a moron), I can't do
this:

READU, Lun, Struct.X

It doesn't seem to assign anything to Struct.X. What I always end up
doing is something like this:

READU, Lun, X
Struct.X = X

Pretty annoying. It's one of those things I never thought about
reporting because I assumed it was a "feature" of some sort. One I
could do without. Oh and ya, the structure and X and everything is
defined prior to the READU.

I have 3 activex related bugs still awaiting resolution right now.
They didn't make it into 5.2, so now I have to wait at least until...
what? 5.2.1? OH well.

Welp, I've babbled long enough, ttyl8r.

Matthew Sheats
Los Alamos National Laboratory
Re: Structure in argument #2 -> With IDL ActiveX control [message #13773 is a reply to message #13641] Thu, 26 November 1998 00:00 Go to previous messageGo to next message
Skiso is currently offline  Skiso
Messages: 5
Registered: August 1998
Junior Member
I understand that it is impossible to pass a entire structure from IDL to VB. But,
why can't I just pass the value of one field of a structure like this:

Example: MyVB_variable = IDLDrawWidget.GetNamedData("MyIDL_structure.my_variable")

It would be _very_ useful!

Skiso



Mark Leaming wrote:

> On Mon, 23 Nov 1998 08:13:43 -0700, "Matthew J. Sheats"
> <sheats@lanl.gov> wrote:
>
>>> Does the GetNamedData() function of the IDL ActiveX control support the
>>> structure definition?
>>
>> Well, the GetNamedData() function returns data as a variant which needs
>> casting. If you have a user defined structure, then there isn't a
>> default cast for it, but what you might be able to do, is write a VB
>> function that could rip the Variant apart into the structure you need.
>>
>> The only issue is, I don't know how IDL would handle a request to
>> return a structure in this way. If it returns bits, then you're ok, but
>> if it doesn't know what to do.. you probably will just get an error.
>>
>> Let me know if you figure it out, I've never tried that before.
>>
>> Matt Sheats
>> Los Alamos National Laboratory
>
> GetNamedData will return an empty variant if the IDL variable that you
> are getting is a structure. The data types that you can retrieve
> using this function are scalars of type byte, short, long, float,
> double and string.
>
> =====================================================
> Mark Leaming
>
> Research Systems, Inc.
> =====================================================
Re: structure [message #15147 is a reply to message #13641] Fri, 23 April 1999 00:00 Go to previous message
Pavel Romashkin is currently offline  Pavel Romashkin
Messages: 166
Registered: April 1999
Senior Member
> b=create_struct('A',findgen(10000),'B',findgen(10000))
>
> I like to have as result,
>
> b[10000].a
> b[10000].b
>

how about

temp = replicate({a: 0.0, b:0.0}, 10000)

temp.a = b.a
temp.b = b.b

b = temp

Hope this will do it.
Cheers,
Pavel
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Finding PSD Mean Frequency
Next Topic: Varaibles higher on the stack

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

Current Time: Sat Oct 11 03:37:47 PDT 2025

Total time taken to generate the page: 1.20324 seconds