Type-Ahead Combo 'widgetized'

Mischa mischa at omnislab.com
Sat Mar 28 09:51:45 EDT 2015

Hi Mats and all,

based on the code Mats thanksfully provided to the list I've made a 'widgetized' version of the type ahead combo box. Basically, it encapsulates Mats' version in a subwindow and builds the widget framework around it.

Why would you want to do that? It's useful when you need more than one TAC in your window, also, being  the main reason for widgets, the handling is more comfortable because you only need to drag the widget subwindow into your main window to make it work, and if you want to update the code, there is only one place where this has to be done.

The 'widgetized' version is based on a previously built source list, that is either passed as parameter, or sent to the widget via $setlist. When passed as parameter, the build of the list must be done already in the declaration of the list variable, because otherwise it will come up empty in the construct of the subwindow, that is prior to the construct of the main window. If the list is built during the construct  of the main window, use Do $cinst.$objs.TypeAheadCombo.$setlist(MyList) after building the list.

The result string is handled via $dataname of the subwindow, as all widgets do.

Also, some more parameters are added to have more influence on the combo box. The first parameter is the source list as already mentioned above.

The second parameter tells if the entry should be restricted to the contents of the source list (0 = no = default, 1 = yes but empty allowed, 2 = yes).  When no restriction applies, and an unknown value is entered, a $learn method is called in the subwindow object of the main window, that optionally gives you the opportunity to add the value to the source list. If you don't provide a $learn method, it is ignored.

The third parameter defines if only a leading occurrence (0, default) or any occurrence (1) should be matched, and the last parameter tells which column of the source list should be used (by number, default = 1)

I've added the Type Ahead Combo widget to my widget demo available on my site, together with an introduction into the widget framework :


You find the download link at the bottom of the article. Note this is an O6.1 library. If there is interest, I'll try to convert it back to a Studio 4 library.
Enjoy ;)


  T H E   O M N I S   L /\ B     www.omnislab.com

More information about the omnisdev-en mailing list