Announcement

Collapse
No announcement yet.

Listview text color per cell

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Listview text color per cell

    I need to be able to change the text color in a listview at run time as it is being drawn initially. It may be several colors that are used in the same or different columns. Ex. Black for positive amounts and Red for negative amounts. Other columns might be different colors for types of investments. The idea could expand to correspond to a pie chart legend on the same screen.

    Thanks,

    Bob Mechler

  • #3
    Bob,

    You need to use the virtual list view. Here's a link to one that shows check boxes, not what you wanted, but close - http://www.powerbasic.com/support/fo...ML/010563.html

    What you have to do is process the wm_notify message for the listview. Then you're going to process %NM_CUSTOMDRAW. Somewhere I have a sample that I documented, so I'd know how it works. If I can find it, I'll post.

    Russ
    "There are two novels that can change a bookish fourteen-year old's life: The Lord of the Rings and Atlas Shrugged. One is a childish fantasy that often engenders a lifelong obsession with its unbelievable heroes, leading to an emotionally stunted, socially crippled adulthood, unable to deal with the real world. The other, of course, involves orcs." - John Rogers

    Comment


    • #4
      An Example by Borje Hagsten


      http://
      www.powerbasic.com/support/forums/Forum6/HTML/002520.html



      Steve

      Comment


      • #5
        >You need to use the virtual list view

        Not true. You can simply process WM_NOTIFY/NM_CUSTOMDRAW notifications for a 'regular' listview control (regular = style does NOT include LVS_OWNERDATA).

        See the multiple checkbox demo link I posted. That uses a 'regular' style listview and owner-draws only selected columns (subitems) on the NM_CUSTOMDRAW notification.

        OWNER-DRAW <> VIRTUAL

        For that matter, a VIRTUAL listview does not require owner-drawing!!

        "OWNER-DRAW" and "VIRTUAL" ARE TWO DIFFERENT THINGS!!!


        MCM
        Michael Mattias
        Tal Systems Inc. (retired)
        Racine WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #6
          Bob,
          I would DEFINITELY look into MCM's Multiple checkbox demo. (It's the one I am blatantly stealing..."oops I meant LEARNING from" )

          What interested me most was ability to change a "Single Cell", font, color etc. and multiple checkboxes that were NOT restrained to the 1st column.

          Some other things I am playing with also found in the forums is comboboxes, instead of editing.

          (Long ways off, but all the more learning)
          Engineer's Motto: If it aint broke take it apart and fix it

          "If at 1st you don't succeed... call it version 1.0"

          "Half of Programming is coding"....."The other 90% is DEBUGGING"

          "Document my code????" .... "WHYYY??? do you think they call it CODE? "

          Comment


          • #7
            Thanks, I have enough to chew on for a while.

            Bob Mechler

            Comment

            Working...
            X