Referencing class variables

Bastiaan Olij Bastiaan.Olij at instinctsystems.com.au
Tue Nov 20 03:13:09 EST 2018


The way I do it is by adding a "static" method to the window class. Omnis does not know the concept of static methods (unfortunately) so it's a hack but it works.


Simply add a method to your window:
getClassVar()
Quit method cClassVar


Now call this method with:
Do Code Method wMyWindow/getClassVar() Returns lvValue

And voila. You can call methods on your class with "do code method" even if there is no instance but obviously then only have access to the class vars.

Kindest Regards,


Bastiaan Olij
Head of development - Instinct Systems: The JobBag People
Ground Floor, 48 Chandos Street
St Leonards NSW 2065
Australia


Phone +61 2 8115 8000
Mobile +61 4 321 44833
bastiaan.olij at instinctsystems.com.au
http://www.jobbag.com



 From:   Thad Bogert <thad at technosolver.com> 
 To:   OmnisDev List - English <omnisdev-en at lists.omnis-dev.com> 
 Sent:   11/20/2018 5:35 AM 
 Subject:   Re: Referencing class variables 

Thanks Peter, 
 
The notation works great for accessing the properties of the variable, but not the contents of the variable itself. 
 
> On Nov 19, 2018, at 7:43 AM, Peter van Rooij <pfvanrooij at gmail.com> wrote: 
>  
> Hello Thad 
>  
> You should use: 
>  
> $libs.myLib.$windows.wMyWindow.$cvardefs.cClassVar 
>  
> if I remember correctly 
>  
> Regards 
>  
> Peter 
>  
>> On 19 Nov 2018, at 16:40, Thad Bogert <thad at technosolver.com> wrote: 
>>  
>> Hi All, 
>>  
>> Does anyone know of a way to obtain the contents of a class variable from a class that has no instances?  The following works if there is an instance: 
>>  
>> $iwindows.wMyWindow.cClassVar 
>>  
>> However if there is no instance, I am not able to reference the variable.  The following notation does not seem to work: 
>>  
>> $libs.myLib.$windows.wMyWindow.$cvars.cClassVar 
>>  
>>  
>> Thanks! 
>>  
>> Thad 
>>  
>>  
>> _____________________________________________________________ 
>> Manage your list subscriptions at http://lists.omnis-dev.com 
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com  
>  
> _____________________________________________________________ 
> Manage your list subscriptions at http://lists.omnis-dev.com 
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com  
_____________________________________________________________ 
Manage your list subscriptions at http://lists.omnis-dev.com 
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com  



More information about the omnisdev-en mailing list