Understanding the Owner-Draw Operators
Description
The power of owner-draw strings is based on the special operators that an owner-draw string can contain. Some of these commands are introduced here. See Summary of Owner-Draw Commands below for a full list. The '@' operator is the 'text select' operator. It selects text from the input value (i.e. from the list of entries that are to be displayed by the list box). The @ operator is followed immediately by a starting position and an optional ending position. For example, {@1,10} specifies that the list box should display the first 10 characters of the input value. {@5,10} specifies that the list box should display character 5 through 10 of the input value. The '@' operator can also be used in conjunction with the '$' and '#' operator (discussed below).
The '$' operator is the sub-string operator. It returns the position of a specified sub-string. For example, $( ) returns the position of the first space in the input value. $($) returns the position of the first '$' in the input value, and so on. Using the '$' operator in conjunction with the '@' operator, you could write {@1,$( )}. This would display text from the input value, starting with position 1 in the input value, and continuing up to and including the first space in the input value. The specification, {@$( )}, on the other hand, would select text, starting with the first space in the input value, and continuing to the end of the input value. In a practical example, you would want to select text starting in the position after the first space, which you would do as follows: {@$( )+1} The '#' operator displays the row number in the list box. For example the owner-draw string:
{@#}: {@1}
displays row numbers, then a colon, then the input value.
Limitations
Desktop applications only
See Also