AW: Object class in a Table class

Martin Obongita martin.obongita at
Fri Nov 25 16:16:31 UTC 2022

 Hi Rudolf,
Thank you for your input.
I understand that if you change the effect property of an edit control (entry field) to inset or embossed then you cannot assign it's border color property.
I hope this will help someone else with a similar challenge.


    On Thursday, November 24, 2022 at 08:10:25 PM GMT+3, Rudolf Bargholz <rudolf at> wrote:  
 Hi Martin,

Just make sure to check your code that you are not constantly creating new object references and not cleaning up the no longer used references, with, for example

Calculate #L4 as $listrefs

Runt your code a couple of times, then check the listrefs list, run it a bit more, and then check again. Ideally the number of object references used in your code will not have changed. If yes, you will have to find out why.

Not cleaning up object references will lead to a crash of Omnis at some point in time.



-----Ursprüngliche Nachricht-----
Von: omnisdev-en <omnisdev-en-bounces at> Im Auftrag von Martin Obongita via omnisdev-en
Gesendet: Donnerstag, 24. November 2022 16:15
An: spomacguy at; OmnisDev List - English <omnisdev-en at>
Cc: Martin Obongita <martin.obongita at>
Betreff: Re: Object class in a Table class

Hi Scott,
I sent the library I was working on to Support UK.
They acknowledged that indeed the instance variable was crashing Omnis.

The problem was referred to Engineering. But thanks be to God, I have wonderful people in this list who quickly found the solution is with object referencing.
I have also decided to use item references more often than instance variables. The referencing of data looks 'cleaner code'.


Sent from Yahoo Mail on Android 
  On Thu, 24 Nov 2022 at 17:58, Scotte Meredith<spomacguy at> wrote:  
Lesson I have learnt is I should use instance variables sparingly.

I'm glad the move to object references worked, however, I would have to disagree strongly about instance variables. I would certainly say to use class and task variables sparingly, but instance variables are the lifeblood of Omnis. Omnis shouldn't have crashed in any case, and it warrants sending a sample in to support to take a look. There really shouldn't be anything we can do as programmers to crash the Studio core.
It's not the instance variables that caused the problem, but something else.

On Nov 24, 2022, at 5:25 AM, Martin Obongita via omnisdev-en <omnisdev-en at> wrote:
 Hi @Kelly and @Phil and @Doug,

The object reference did the trick.
Omnis crashing when an object instance in a table super class is called, is now sorted.
Thank you so much.
Lesson I have learnt is I should use instance variables sparingly.
It's cool to know there are beautiful people out in space ready and willing to throw in a lifesaver.


    On Thursday, November 24, 2022 at 02:55:19 AM GMT+3, Kelly Burgess <kellyb at> wrote:  

 Hi Martin,

I have never used object reference in my code.
This is because I don't understand how to use them.
I use instance variables of type object, sub type object class created in table classes, to call methods in object classes.

The way you do it now is you create an instance var of type Object and you assign the subtype to be your object class.

To change over to an Object Reference, you just change the variable type to Object Reference.  You leave the subtype as it is, but for an object reference, the subtype is only used to tie the variable to an object class for purposes of using the Interface Manager - so it can show you the class's methods and properties.  Assigning the subtype is optional - you don't have to commit to using the Object Reference with a particular class.

The second thing you need is a line in your $construct to create the object instance.  With your current approach, the instance is created the first time the variable is referenced during code execution.  With an object reference, the instance is created when you execute a $newref().

    Calculate myObjRef as $clib.$objects.oMyObjClass.$newref()

The third thing you need is code in your $destruct to clean up the object.

    If myObjRef.$validref()
        Do myObjRef.$deleteref()
    End If

Omnis has improved automatic garbage collection in the last few years, so maybe that $destruct cleanup is no longer needed, but it's good practice.

Object references are used just like item references, so you don't need to change any of your code that uses the variable.  The problem with item refs is that sometimes when you pass one to another method, a new instance gets created and you lose whatever context the original instance carried with it.  Object references can be passed around, kept in lists, etc. without that worry.


Manage your list subscriptions at
Start a new message -> mailto:omnisdev-en at 

Manage your list subscriptions at
Start a new message -> mailto:omnisdev-en at 

Scotte Meredithspomacguy at gmail.com509/998-0991

Manage your list subscriptions at
Start a new message -> mailto:omnisdev-en at 

More information about the omnisdev-en mailing list