How do I override a variable from a superclass programmatically?

Doug Easterbrook doug at artsman.com
Wed Sep 25 17:59:30 UTC 2024


at the risk of not really understanding.

is this an inherited variable you want to over-ride?    i,e,   the superclass has ‘iList’ and the subclass has ‘iList’ inherited from the main window.

I’ve never found an need to do this as overriding the inherited variable always has led to debugging grief.  Far better to declare a variable and copy it value if you don’t want to touch the superlass value


or is this just a small subwidow (such as a popup) that refers to the main window’s variables?   

In such as case I always refer to the main window variables as $cwind.theVar and never declare it locally.     Or I declare a reference to the main window and reference variables that way with a getter/setter

So, if I want a copy of the variable that I play with internally, I copy it as needed and save it as needed.




In the latter situation (ie. the variable is not inherited), my thoughts are that you are asking for a developer support issue if you use the same name for the variable because somebody will change things on yoy, whether you want to or not.

there is the old adage, blue code is good code and black code is bad code.   Same with instance variables.   Blue variables are good variables black variables are local only..  and should not be able to be inherited.   because that would be my first inclination when editing code as I know it causes some elements of debugging grief
if they are not inherited.



so, thats standing on a soap box….    maybe you could explain the use case or why you need to use a variable of the same name (if not inherited).



Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978

> On Sep 25, 2024, at 10:04 AM, Scotte Meredith <spomacguy at gmail.com> wrote:
> 
> I have a superclass window. I've added a new instance variable. 
> 
> In the child windows, I want to override the instance variable programmatically. I can do this from the context menu in the instance variable list pane by right-clicking on the variable and selecting "Override Variable". 
> 
> How do I do this programmatically?
> 
> 
> Scotte Meredith
> spomacguy at gmail.com
> 509/998-0991
> 
> 
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com



More information about the omnisdev-en mailing list