Omnis Technical Note TNID0004 October 2006

Creating your own Component Store Objects

For Omnis Studio 3 or after
By Götz Krija

When you are developing an application you may want to use a certain object with the same functionality and the same properties in several different windows, e. g. a Save button. In order to save time you could copy the ready button with holding the Ctrl key into several other windows.

Another possibility is to include this special button in the Component Store and to drag it from there into the appropriate windows. To do this, Right-click on the Libraries node in the Studio Browser and select the "Show Comps.lbs" option from the context menu.

The Component Library will be opened which includes, among other items, the window "_Field Components".

This window class contains all the (foregorund) fields and window objects available in the Omnis Component Store that you can place on a window. You can add your own fields or components to this window, such as a new Save button, and customise them as you wish.

Click on the Hide Comps.lbs option to close the Component Library and save any changes you have made. The new Save button, or any other components you added, will appear in the Component Store.

The other possibility to re-use the customised button several times is to include it as a subwindow field in the different windows. This gives you two advantages: First it is not necessary to create multiple copies of this button in your library, and also this button is now appearing in the Component Store, too.

Therefore create a new window "wSub" in your library and drag a button into it. Modify this button according to your requirements and place it in the upper left corner of this window. Then minimize the window so that its right and its bottom border correspond to the appropriate borders of this button, and set the property $issubwindow to kTrue.

From now on you can drag the button as a subwindow field from the Component Store into any window; to display subwindows in the Component Store you need to click on the Subwindows button in the Component Store toolbar. You may want to set the $effect property of your subwindow field to kBordernone to hide any borders around the button contained in the subwindow.