` Printed Icetips Article

Icetips Article



Par2: Conditionally underline row in listbox
2003-02-12 -- Michael Ware
 
Some of this is ABC template specific, but the theory stays the same
regardless:

1. In the list box formatter, check on the "Style" box for each field in the
row. (NOTE: Use either Style OR Color, never both.  You can control color
with the style.)

2. In the Window's Init set up "Normal" and "Underline" Styles like this:
    ! Normal
  ?List1{PROPSTYLE:FontName , 1}     = 'Arial'
  ?List1{PROPSTYLE:FontSize , 1}     = 10
  ?List1{PROPSTYLE:FontStyle, 1}     = FONT:Regular
  ?List1{PROPSTYLE:TextColor, 1}     = COLOR:Black
  ?List1{PROPSTYLE:BackColor, 1}     = COLOR:White
  ?List1{PROPSTYLE:TextSelected, 1}  = COLOR:White
  ?List1{PROPSTYLE:BackSelected, 1}  = COLOR:Navy

! Underlined
  ?List1{PROPSTYLE:FontName , 2}     = 'Arial'
  ?List1{PROPSTYLE:FontSize , 2}     = 10
  ?List1{PROPSTYLE:FontStyle, 2}     = FONT:Bold + FONT:Underline
  ?List1{PROPSTYLE:TextColor, 2}     = COLOR:Navy
  ?List1{PROPSTYLE:BackColor, 2}     = COLOR:White
  ?List1{PROPSTYLE:TextSelected, 2}  = COLOR:White
  ?List1{PROPSTYLE:BackSelected, 2}  = COLOR:Black


3. If this is an ABC Browse, there is a style tab where you can specify 1 as
the default style number and 2 as the style # to use if your condition is
met. If this is hand coded, use a long field in the queue after each field
being displayed and set this to either 1 or 2 for the style desired.

Jim Mumford adds:

The following combination worked for me:

MyQ   Queue,Pre(MyQ)
Field1         STRING(10)   !These Larger than needed for underline
FontStyleField1
Field2         STRING(50)   !These Larger than needed for underline
FontStyleField2
Field3         STRING(50)
END

!Checked Style for Column 1 and Column2 in List Box

?MyList{PropStyle:FontStyle,1}=FONT:Regular
?MyList{PropStyle:FontStyle,2}=FONT:Underline



IF UnderLineCondition=TRUE
   !Field 1 and 2 are underlined
   FontStyleField1=2
   FontStyleField2=2
   Field1=CLIP(Field1) & ALL('_',SIZE(Field1)
   Field2=CLIP(Field2) & ALL('_',SIZE(Field2)
ELSE 
   !Field 1 and 2 are not underlined
   FontStyleField1=1
   FontStyleField2=1
END   
   PUT(MyQ)



Printed November 21, 2024, 12:00 pm
This article has been viewed/printed 35223 times.