comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve D" <nospam_steved94@comcast.net>
Subject: Re: COM problem
Date: Wed, 26 Aug 2009 20:57:28 -0700
Date: 2009-08-26T20:57:28-07:00	[thread overview]
Message-ID: <Tunlm.268202$E61.186923@newsfe09.iad> (raw)
In-Reply-To: <61b5f53d-51f5-4f8e-8586-b176a75bb139@c14g2000yqm.googlegroups.com>

"Chrono" <pablittto@gmail.com> wrote in message 
news:61b5f53d-51f5-4f8e-8586-b176a75bb139@c14g2000yqm.googlegroups.com...
> On 25 ago, 22:50, "Steve D" <nospam_steve...@comcast.net> wrote:
>> "Pablo" <pablit...@gmail.com> wrote in message
>>
>> news:1e5e4fd4-5de0-46e6-8c58-d2c7a6fb222a@k6g2000yqn.googlegroups.com...
>>
>> >I have a field type Field_Type whose record values I have to set into
>> > a variant variable. How do I do this?
>>
>> If you're using GNATCOM (for example):
>>
>>   float_value : float := 42.0;
>>   variant_value : GNATCOM.Types.VARIANT;
>>   ...
>>   value := GNATCOM.VARIANT.To_VARIANT( float_value );
>>
>> You can find GNATCOM at:http://sourceforge.net/projects/gnavi/files/
>>
>> Regards,
>> Steve
>
> You understood what I meant... but my problem is that my variable is a
> record. Say us, I have a Field_Type defined as a record like
>   type Field_Type is
>      record
>         Truth : GNATCOM.Types.VARIANT_BOOL;
>         Determination    : Interfaces.C.double;
>      end record;
> so in my code I set the values like
>   Field : Field_Type  := (Truth => 1, Determination => 5.323423423);
>
> Then I have to convert this Field_Type Field into a Variant type
>   My_Variant : aliased GNATCOM.Types.VARIANT;   ***
>
> Due to I have to execute a method
>   Method (Parameter_Doesnotmatter, My_Variant'access);
>
> *** So this is the problem... would you please help me? Thanks so much.


You probably need to create a local of type GNATCOM.TYPES.VARIANT ... 
.something along the lines:

  My_Variant : aliased GNATCOM.Types.VARIANT;
  ...
  My_Variant := GNATCOM.VARIANT.To_VARIANT( Field.Truth );
  Method( Parameter_Doesnotmatter, My_Variant'access );

Unfortunately I haven't used Ada much in the last couple of years, and I 
don't have a compiler handy to verify this, but this is where I would start.

Regards,
Steve 




  reply	other threads:[~2009-08-27  3:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-25 16:48 COM problem Pablo
2009-08-25 19:07 ` Adam Beneschan
2009-08-26 18:06   ` Chrono
2009-08-26 19:42     ` Adam Beneschan
2009-08-26 19:47   ` Chrono
2009-08-26  1:50 ` Steve D
2009-08-26 18:07   ` Chrono
2009-08-27  3:57     ` Steve D [this message]
2009-08-26 19:47   ` Chrono
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox