OO: a paradigm question - buttons on the window

Doug Easterbrook doug at artsman.com
Mon Jan 11 12:54:57 EST 2010

hi Franco.

Back again with another design quesiton.

my example that I gave works for making lists generic.   its great.

now, based on what you said below and Gier's comment about buttons  (I'm still bowing and scraping the floor).., here is something we do as well.

In the superclass, we put a subwindow area under our list (actually, we have about 6 of them for different purposes).

if the subwindow is empty, then there are no buttons

if we assign a 'windowname' to the subwindow, that window name contains only buttons.  That allows us to change which buttons are on the window.    So back to my previous example, if I have a variable in my superclass called 'iButtonWindow' and if it defaults to blank, then there is no buttons on the screen.

if, in my windows $initialize  (not the construct, the $construct calls $initialize so that I don't have to override $construct)...... i put something like this.

calc  iButtonWindow as 'buttonWindow'

and buttonWindow is a skinny window with just some buttons on it.

and my superclass looks at this field and sets up the properties of the subwindow to be 'buttonWindow' if iButtonWindow is filled in...

THEN...  with changing one variable, my superclass puts a button bar on the window in the place of my choice and it can be a different button window for every list window.

hence, looks like one line of black code to set a PROPERTY to tell the window which subwindow to use...   means that I have lots of blue code.

in the buttonWindow, the trick is to communicate to the parent window.   very very easy.  If, when instantiating the subwindow, you pass a parameter of $cinst().$ref, then it tells the subwindow who created it.   Your subwindow shod track that, lets say in iWindowRef..

and then all buttons can do the work in the main window by:

  do  iWindowRef.$clickButtonOpen

(or something like that).

This is a very abstract but very useful topic and I'd be happy to explain it further (perhaps a phone call or a sample)... the essence of the idea is:

a) put a placeholder subwindow where the buttons should be
b) decide what the button window should be by setting a value in your child window
c) tell the child window, when it starts, who told it to be created ($cinst().$ref parameter)
d) let the child window talk to the parent window using parent window reference.

very few lines of code.... very powerful

Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
Phone (403) 536-1205    Fax (403) 536-1210

On Jan 11, 2010, at 10:00 AM, omnisdev-en-request at lists.omnis-dev.com wrote:

> For Doug:
> I payed a special attention reading your message. Let me transfer your
> statement into code, and "copy" the OO concepts from
> iList.$setColumnsInWindow, so adding something like iButton.$setNewPosition

More information about the omnisdev-en mailing list