Omnis Technical Note TNGI0017 April 2007

Creating your own Omnis desktop

For Omnis Studio 3 or after
By Götz Krija

By default, Omnis Studio has a grey background (under Windows), that is, the desktop or grey area within the main Omnis application window (we are not referring to the Windows desktop here). However there is no property with which you can customise the background colour of Omnis or even insert a picture. But with a little trick you can do this quite easily. For example, you may want to add a different color to the Omnis application desktop to compliment your application windows or you could add an image that includes your company logo or tagline.

To achieve this, add a new window class to your library and name it 'wBackground'. Open the window in design mode and add your picture using the 'Paste From File' option (Edit menu). Your picture should be large enough to cover the entire background even when Omnis is maximised and your screen is set to high resolution (e.g. the image can be 1280 x 1024 pixels at 72 dpi, saved as JPG: see below for an example image). Then modify the following properties of wBackground:


In addition the property $edgefloat of the window must be set to kEFrightBottom to make sure the window will enlarge when the user changes the size of the Omnis application window. In the $construct() method of wBackground now add the following code to adjust and align it according to the current size of Omnis:

Do $cinst.$width.$assign($root.$modes.$width)
Do $cinst.$height.$assign($root.$modes.$height)
Do $cinst.$top.$assign(0)
Do $cinst.$left.$assign(0)

Then add another window class 'wSuper' to your library and add to it a class method called $event() with the following code:

On evWindowClick
 If pClickedWindow.$name='wBackground'
  Quit event handler (Discard event)
 End If

This code will make sure that the window wBackground will not come to the top if a user clicks on it. Then assign the new superclass to all window classes. You can do this either manually (property $superclass=wSuper) or with the following command:

Do $windows.$sendall($Ref.$superclass.$assign('wSuper'))

Then don't forget to open wBackground in the $construct method of the Startup_Task in your library using the command:

Do $windows.wBackground.$openonce()

If you want to try this out, here is a pic for you to use (Right/Cmnd-click the link to Save the image). The final result could look something like this:

Omnis desktop