Announcement

Collapse
No announcement yet.

Listview with ProgressBar

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

  • #21
    Hm, added a cw3 variable for third column and after that has been taken
    care of, can do something like:
    Code:
      'COLUMN.. the rest..
      GetClientRect hListView, rc
      rc.nLeft  = cw1 + cw2 + cw3 'add up column widths and see if we have something left to paint
      IF rc.nLeft < rc.nRight THEN FillRect @lpdis.hDC, rc, GetSysColorBrush(%COLOR_WINDOW)
    Have only used ownerdrawn listview once before, in code where I wanted
    columns in different colors, so fumbling in the dark here. Normally, not
    necessary to sub-class and handle WM_ERASEBKGND, but this is a bit special.
    Okay, if process is slow and fast screen update, guess one can live with
    slight flicker and skip sub-class. Definitely better for total repaint..

    Real neat implementation is by also adding %LVS_OWNERDATA style to LV.
    Then, virtual, ownerdrawn listview - must keep items in global array,
    but advantage is one can add a million items to list instantly. See if
    I can extract a sample from other huge code here later on today.

    Nor sure about THREAD CLOSE there. Never had to work with the THREAD
    commands, so don't know if it's correct way to do it.

    ------------------
    Forgot, need to add "DECR rc.nTop" after text is drawn in second column,
    otherwise it will cause "lines" in last columns.


    [This message has been edited by Borje Hagsten (edited October 20, 2001).]

    Comment


    • #22
      Okay, found that keeping it sub-classed and trapping %WM_NCPAINT
      helps a lot. Can still fail to ensure proper redraw in some cases,
      but mostly works pretty well. Have changed code above too.
      Code:
      CALLBACK FUNCTION LvSubClass
        SELECT CASE CBMSG
           CASE %WM_NCPAINT 'something triggered repaint, allow it to happen
              pbStep = 0
       
           CASE %WM_ERASEBKGND
              IF pbStep THEN   'prevent repaints during progress
                 FUNCTION = 1 : EXIT FUNCTION
       
              ELSE             'but sometimes need to ignore and repaint..
                 pbStep = 1
              END IF
       
        END SELECT
        FUNCTION = CallWindowProc(OldLvProc, CBHNDL, CBMSG, CBWPARAM, CBLPARAM)
      END FUNCTION

      ------------------

      Comment


      • #23
        Thanks Borje, Everything works now. I turned off Column headers
        because if you move the columns around and scroll to the right
        it messes up repainting. The makes sense because we used the
        width of each column. Not the position of each column.

        In any case, I think it looks better without Column headers.

        Thanks again,



        ------------------
        -Greg
        -Greg
        [email protected]
        MCP,MCSA,MCSE,MCSD

        Comment


        • #24
          Lance;
          Cute Jules!
          At least my wife thinks so...

          p.s. BTW, can't take the credit, that belongs to Borje!

          Regards,
          Jules

          Comment

          Working...
          X