Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Nov 22, 2017 4:52 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: REALArray element type
PostPosted: Tue May 15, 2012 4:07 am 
Offline

Joined: Wed Sep 10, 2008 3:22 pm
Posts: 27
Location: Italy
Hi everyone,

I'm developing my first plugin and I need some suggestions on how to detect elements type within a realbasic array. More precisely the class in my plugin need a method like this one

Constructor(vect() as Variant)

which will be called in the following ways:

1) Dim myClass as new PluginClass(array(1,2,3,4))
2) Dim myClass as new PluginClass(array(1.0, 2.0, 3.0, 4.0))

Within the c++ plugin code how can I determine that in the first case array elements are integers while in case two are float?
I think that being a Variant array, elements type should be REALObject and from this I can inspect the "Type" property within the variant object. Is that correct?
Another solution would be to expose different constructor methods for each array type.

What do you suggest?

Many Thanks

Bye

Marco


Top
 Profile  
Reply with quote  
 Post subject: Re: REALArray element type
PostPosted: Tue May 15, 2012 4:16 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
mistiko wrote:
I think that being a Variant array, elements type should be REALObject and from this I can inspect the "Type" property within the variant object. Is that correct?


yes

mistiko wrote:
Another solution would be to expose different constructor methods for each array type.

yes, this can be better to control what people can pass.

PS: Please delete other thread.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: REALArray element type
PostPosted: Tue May 15, 2012 7:26 am 
Offline

Joined: Wed Sep 10, 2008 3:22 pm
Posts: 27
Location: Italy
Thank you Christian for your prompt and useful reply, can I delete the other post or only admins can do that?

Bye

Marco


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group