Xojo Conferences
XDCMay2019MiamiUSA

REALSetPropValue failling (Real Studio Plugins Mailinglist archive)

Back to the thread list
Previous thread: Re: ENUMS simulations // Interface glitches.
Next thread: Safari Bookmark -> Listbox


macosx and unix paths   -   GOLD
  REALSetPropValue failling   -   Alexander Cohen
   Re: REALSetPropValue failling   -   William Yu
   Re: REALSetPropValue failling   -   Joseph J. Strout
   Re: REALSetPropValue failling   -   Joseph J. Strout
   Re: REALSetPropValue failling   -   Alexander Cohen
   Re: REALSetPropValue failling   -   Joseph J. Strout
   Re: REALSetPropValue failling   -   Alexander Cohen
   Re: REALSetPropValue failling   -   Joseph J. Strout
   Re: REALSetPropValue failling   -   Alexander Cohen

REALSetPropValue failling
Date: 17.06.04 16:13 (Thu, 17 Jun 2004 11:13:31 -0400)
From: Alexander Cohen
Does anyone see any reason that this method would fail? Am i missing
something important about the REALSetPropValue and REALGetPropValue
routines?

void
REALvariantSetObject( REALobject variant, REALobject value )
{
if (!value) return;
if (!variant) return;

if ( ! REALSetPropValue( variant, "ObjectValue", value ))
{
REALDebugMsg( "REALvariantSetObject() - FAIL" );
return;
}
REALDebugMsg( "REALvariantSetObject() - OK" );
}

thanks!

Alex

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: REALSetPropValue failling
Date: 17.06.04 17:20 (Thu, 17 Jun 2004 11:20:26 -0500)
From: William Yu
On 6/17/04 10:13 AM, "Alexander Cohen" <<email address removed>> wrote:

> Does anyone see any reason that this method would fail? Am i missing
> something important about the REALSetPropValue and REALGetPropValue
> routines?
>
> if ( ! REALSetPropValue( variant, "ObjectValue", value ))

ObjectValue is a method on the variant object, but it's also getter-only,
i.e. you can only call the method to get the value, and not set the value.

Regards,
William Yu
<email address removed>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: REALSetPropValue failling
Date: 17.06.04 18:04 (Thu, 17 Jun 2004 12:04:50 -0500)
From: Joseph J. Strout
Variants are essentially immutable; you're intended to create a new
Variant object out of the desired value. But though we have
REALNewVariantInteger, etc., REALNewVariantObject seems to be
missing. I think this is an oversight, and would suggest filing a
feature request to have that added.

Best,
- Joe

Re: REALSetPropValue failling
Date: 17.06.04 18:29 (Thu, 17 Jun 2004 12:29:55 -0500)
From: Joseph J. Strout
At 12:04 PM -0500 6/17/04, Joseph J. Strout wrote:

>Variants are essentially immutable; you're intended to create a new
>Variant object out of the desired value. But though we have
>REALNewVariantInteger, etc., REALNewVariantObject seems to be
>missing. I think this is an oversight, and would suggest filing a
>feature request to have that added.

Wait, cancel that. I was confused (a common symptom of working with
Variants!). Any object reference *is* a valid variant reference. No
conversion is needed. That's why there is no API for it. (There is
no need to get the ObjectValue, either -- if the variant contains an
object, then its value *is* the ObjectValue in question.)

Of course this wasn't always the case, and may not always be the case
in the future, so an argument could be made that we should support
have these conversion functions in the API just for the sake of
future-proofing.

Best,
- Joe

Re: REALSetPropValue failling
Date: 17.06.04 18:40 (Thu, 17 Jun 2004 13:40:12 -0400)
From: Alexander Cohen
So, in other words, this is ok:

REALobject
GetObjectAsVariant( REALobject instance )
{
REALLockObject(instance);
return instance;
}

and define if for rb like this:

ObjectToVariant( obj as object ) as variant

Can i do this?

Alex

On Jun 17, 2004, at 1:29 PM, Joseph J. Strout wrote:

> At 12:04 PM -0500 6/17/04, Joseph J. Strout wrote:
>
>> Variants are essentially immutable; you're intended to create a new
>> Variant object out of the desired value. But though we have
>> REALNewVariantInteger, etc., REALNewVariantObject seems to be
>> missing. I think this is an oversight, and would suggest filing a
>> feature request to have that added.
>
> Wait, cancel that. I was confused (a common symptom of working with
> Variants!). Any object reference *is* a valid variant reference. No
> conversion is needed. That's why there is no API for it. (There is
> no need to get the ObjectValue, either -- if the variant contains an
> object, then its value *is* the ObjectValue in question.)
>
> Of course this wasn't always the case, and may not always be the case
> in the future, so an argument could be made that we should support
> have these conversion functions in the API just for the sake of
> future-proofing.
>
> Best,
> - Joe
>
> --
> ,------------------------------------------------------------------.
> | Joseph J. Strout REAL Software, Inc. |
> | <email address removed> http://www.realsoftware.com |
> `------------------------------------------------------------------'
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://support.realsoftware.com/listmanager/>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: REALSetPropValue failling
Date: 17.06.04 18:56 (Thu, 17 Jun 2004 12:56:10 -0500)
From: Joseph J. Strout
At 1:40 PM -0400 6/17/04, Alexander Cohen wrote:

>So, in other words, this is ok:
>
>REALobject
>GetObjectAsVariant( REALobject instance )
>{
> REALLockObject(instance);
> return instance;
>}

Yes, that should work fine.

>and define if for rb like this:
>
>ObjectToVariant( obj as object ) as variant
>
>Can i do this?

I suppose, though the utility of that is not obvious to me.

Best,
- Joe

Re: REALSetPropValue failling
Date: 17.06.04 19:15 (Thu, 17 Jun 2004 14:15:21 -0400)
From: Alexander Cohen
On Jun 17, 2004, at 1:56 PM, Joseph J. Strout wrote:
>
>> and define if for rb like this:
>>
>> ObjectToVariant( obj as object ) as variant
>>
>> Can i do this?
>
> I suppose, though the utility of that is not obvious to me.

That was just an example. I need create an array object in a plugin
that can be passed from rb to the plugin and back. That array object
needs to be able to hold any data type rb supports. So i need to use
variants. So the data structure for the array will be:

struct arrayData
{
REALobject * array;
int count;
};

This brings a question to mind. How will i get an integer or a double
or any rb type that is not class out of the object. When i insert it,
ill just use one of the REALNewVariant functions, but to get it back im
a bit confused. Should i then use one of the dynamic function getter or
property getter routines (REALGetPropValue, etc...) ?

Am i reinventing the wheel? Can i do this already with the rb array
type?

Alex

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: REALSetPropValue failling
Date: 17.06.04 19:21 (Thu, 17 Jun 2004 13:21:18 -0500)
From: Joseph J. Strout
At 2:15 PM -0400 6/17/04, Alexander Cohen wrote:

>This brings a question to mind. How will i get an integer or a
>double or any rb type that is not class out of the object. When i
>insert it, ill just use one of the REALNewVariant functions, but to
>get it back im a bit confused. Should i then use one of the dynamic
>function getter or property getter routines (REALGetPropValue,
>etc...) ?

Yes, use REALGetPropValue.

>Am i reinventing the wheel? Can i do this already with the rb array type?

In RB yes, but not in a plugin.

Best,
- Joe

Re: REALSetPropValue failling
Date: 17.06.04 19:51 (Thu, 17 Jun 2004 14:51:15 -0400)
From: Alexander Cohen
Hmm, seems a bit fishy. Is this wrong in any way?

struct ArrayData
{
REALobject * array;
int count;
};

void
Array_AppendInt( REALobject instance, int i )
{
REALobject v = REALNewVariantInteger(i);
Array_AppendObject(instance,v); // reallocates room in the list, locks
the object and places it
}

REALobject
Array_Get( REALobject instance, int index )
{
ClassData (Array, instance, ArrayData, data);
if (index < 0 || index >= data->count)
{
REALRaiseOutOfBoundsException();
return NULL;
}
REALobject v = data->array[index];
REALLockObject(v);
return v;
}

in rb:

Get( index as integer ) as Variant

It goes thorugh fine and the object is valid in the plugin, but when i
assign it in rb i get a crash:

dim x as integer
x = myPlguinArray.Get(0) // crash

Can i do this?

Alex

On Jun 17, 2004, at 2:21 PM, Joseph J. Strout wrote:

> At 2:15 PM -0400 6/17/04, Alexander Cohen wrote:
>
>> This brings a question to mind. How will i get an integer or a double
>> or any rb type that is not class out of the object. When i insert it,
>> ill just use one of the REALNewVariant functions, but to get it back
>> im a bit confused. Should i then use one of the dynamic function
>> getter or property getter routines (REALGetPropValue, etc...) ?
>
> Yes, use REALGetPropValue.
>
>> Am i reinventing the wheel? Can i do this already with the rb array
>> type?
>
> In RB yes, but not in a plugin.
>
> Best,
> - Joe
>
> --
> ,------------------------------------------------------------------.
> | Joseph J. Strout REAL Software, Inc. |
> | <email address removed> http://www.realsoftware.com |
> `------------------------------------------------------------------'
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://support.realsoftware.com/listmanager/>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>