Omnis Technical Note TNGI0002

Embedding Styles Within Lists

For Omnis Studio version 1.1 and above
By Nicky Mason


This document describes how to embed styles into an Omnis list object.

Contents

Why Would You Use Styles Within Lists ?
How Do I Do It ?

Why Would You Use Styles Within Lists ?

Styles are used within lists to change the appearance of any cell in one of the OMNIS list objects. The objects that can use styles are

  • Headed List Boxes
  • Check List Boxes
  • List Boxes
  • Tree Lists

You can change the font style of a particular cell to be bold, italic or underlined on Windows platforms, or set any of the Mac styles, eg. Shadow or outline for Mac platforms. You can change the colour of the text and you can even add an icon to the text.

How Do I Do It ?

Examples of how to use styles follow, basically the style is embedded within the text, so to add a line
to a list, with the first column a normal number and the second with green coloured text, you would
use the following code:


Add line to list {(5,con(style(kEscColor,kGreen),'Hello'))}

To add an blue dot icon just before the text, you would use the following code:

Add line to list {(5,con(style(kEscBmp,1756),'Hello'))}

To change the style of the text, you would use the following :

Add line to list {(5,con(style(kEscStyle,kBold),'Hello'))}

To add multiple different styles to some text, you would use the following:

Add line to list {(5,con(style(kEscStyle,kBold),style(kEscBmp,1750),style(kEscColor,
kMagenta), 'Hello'))}

If you wanted to change a line in the list based on a users action, then you could do the following:

On evDoubleClick ;; Event Parameters - pRow ( Itemreference )
Load from list
Calculate iv_Text as con(style(kEscColor,kRed),iv_Text)
Replace line in list


This would load the line from the list and replace it with red text.

Download RTF Document

Download Sample Library