Re: A little problem defining a variable

Jean-Luc Arnaud <jean-luc-E/[email protected]>
Newsgroups gmane.comp.lang.realbasic.user
Organization Centre Direct du Multimédia
Message-ID <[email protected]>
Yes, with pleasure.

Off list, of course.

Thanks a lot, Jon.

Jean-Luc Arnaud

Le 20/06/2017 à 18:49, Jon Ogden a écrit :
> Yes, I would do that.  I can send you an example file if you like…
>
> Jon
>
>> On Jun 20, 2017, at 11:01 AM, Jean-Luc Arnaud <jean-luc-E/[email protected]> wrote:
>>
>> Thanks for replying, Jon.
>>
>> I tried that but had some issues. Probably something I did wrong. Well, will try again.
>>
>> I think my mistake was to create the SuperClass AFTER creating the SubClass. I guess I have to do that in the natural way, that is SuperClass BEFORE SubClass.
>>
>> Thanks a lot.
>>
>> Jean-Luc Arnaud
>>
>> Le 20/06/2017 à 13:51, Jon Ogden a écrit :
>>> I had a situation where I had to do this myself and what I did was I created a master subclass for my two objects that had all the “common” items.  I then created two subclasses of that custom subclass and put what was different in those.
>>>
>>> Now you can treat them as a common subclass of type MySubclassObject for example.  But then in your code you can check which you are dealing with using IsA.  So your property is of type MySubclassObject but each on is say MySubclassObject1 and MySubclassObject2.
>>>
>>> Then you do:
>>>
>>> If MyProperty IsA MySubclassObject1 Then
>>>
>>>      // Do this
>>>
>>> Else
>>>
>>>     // Do something else
>>>
>>> End If
>>>
>>> Now you can also use class methods and events to help define the master property/variable as well.
>>>
>>>
>>> Hope this helps.
>>>
>>> Jon
>>>
>>>> On Jun 20, 2017, at 4:44 AM, Jean-Luc Arnaud <jean-luc-E/[email protected]> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I'm facing a little problem when defining a variable.
>>>>
>>>> My project has two ContainerControls, each of them representing graphically two objects very equivalent but not totally identical.
>>>>
>>>> In my code, I have to define a variable representing only one of these objects, but I don't know, when defining it, what object.
>>>>
>>>> Here is my problem: How to define a variable I don't know the type (Object1 or Object2), based on class ContainerControl?
>>>>
>>>> I tried to define it as ContainerControl, but can't assign it later the type Object1 or Object2.
>>>>
>>>> I tried to define it as Object1, but can't redefine it as Object2 is needed.
>>>>
>>>> I'm sure the solution is obvious, but can't figure it out.
>>>>
>>>> TIA for your help.
>>>>
>>>> -- 
>>>> Jean-Luc Arnaud
>>>>
>>>>
>>>>
>>>>
>>>> To unsubscribe click: <http://email.lists.xojo.com/u/eJwNyzsOwyAMANDThI3I_M3A0KMYG7dUpZGi5P7t2580j-LQzIY5J6pcLYMTq4XAApZkUSvVUF0ejFsElnV_rrmGTNr1NK8WRXVw0MDYY_ddYVQfsXAK5AN4c7b38ZTx_e9FvPOxzNU2__gBkrEkHw>
>>>>
>>>
>>> To unsubscribe click: <http://email.lists.xojo.com/u/eJwNy0sOgyAQANDTyA4zZYbfgoUUew9kIKURmxi9f_v2j4Ny_HCiBw_RpmiijM6ukhIkGRNZaV6E6xO0ogUmgpHLXL5DvANUrbluhrJTxnPxltuGjRAVIngUZ_jUfMj9Lv9XeNz71Uflnud2iitMavkBGxkjEQ>
>>>
>>>
>>
>>
>>
>> To unsubscribe click: <http://email.lists.xojo.com/u/eJwNy0sOwiAQANDTlB0NzFQcFix6lPmhGLFJU--vb_-sAVmmMJow3jTXElFRo0Pq0RgxgmeSylTdy7Iltfl9X2O6DV77GZ7NirNb6prNiUR6QtYKyhXkbraFs72Oh_nnvyfrqscMV1tg_wHvciWy>
>>
>
>
> To unsubscribe click: <http://email.lists.xojo.com/u/eJwNyzsOwyAMANDThI3Ixi6fgSERzT0oBpUqtFKU3L_Z3vIkGi_oVY_8XMjZLWmbHqwZN9Ar3_Ip0RoAiCBMDCOXufyGekds6DIyg1iHwRTLJAhWqms-tJdTR_zU_NX7Ve5XZFz72UeVnud2qDNOZvkD7ckipA>
>
>




To unsubscribe, email [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.