` Printed Icetips Article

Icetips Article



ABC: Using derived BufferFieldsClass to change listbox colors
2002-04-03 -- Dennis E. Evans
 
Newsgroups: softvelocity.products.c55ee

Hi all.

> I am trying to make my code more managable.  Here is my situation.  I have a
> browse which is filled from a Queue.  This browse has individual cells
> colored based on various parameters.  Currently my queue looks like this.

     As all ready said styles are typically much simpler to deal with than
the four color variables.
In addition, using a derived BufferFieldsClass makes thing very easy.
Derive the class and add a method that allows you to control what is stored
in the buffer field.

  Then in your code add the queue fields and the style numbers to the
derived BufferFieldsClass,

loop while (ListControl{proplist:exists, ColorCount})
  ! assign the style field to the ThreeFieldClasses
  Self.ColorFlds.AddThreeFields(StyleOne, StyleTwo, what(Self.GbQ,ColorCount + offset))
     ColorCount += 1
     offset += 1
 end

That will assign the style field to the buffer and the styleOne/Two to the
left and right.
To assign the styles you just
  Self.AssignLeftToBuffer() or AssignRightToBuffer()

 To change the colors step through the list property and List.Right = new
style number or the left side.

    You can also have individual cell or conditional colors, but that
requires a bit more fooling around.       If you don't want to deal with the
styles use 4 element arrays to hold the color values and assign the array
elements to the derived bufferFieldClass.   As always this belongs in a
derived class.


    Dennis



Printed November 23, 2024, 2:25 am
This article has been viewed/printed 35398 times.
Google search has resulted in 34 hits on this article since January 25, 2004.