Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Article Writing
  4. OWNERDRAW Listbox help

OWNERDRAW Listbox help

Scheduled Pinned Locked Moved Article Writing
helpcomlearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Neil Lamka
    wrote on last edited by
    #1

    I have an application that subclasses an LBS_OWNERDRAWFIXED listbox window. When I subclass the window it seems to break the listbox so that horizontal scrolling and painting do not work correctly (perhaps other things as well that I have not gotten to yet. Assuming that it was a problem with my subclass procedure I reduced it to the following code: //* The listbox definition in the dialog resource LISTBOX ID_USERS_LISTBOX, 3, 22, 324, 185, LBS_OWNERDRAWFIXED | LBS_MULTICOLUMN | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP //* Subclass the listbox earlier in the code.... fpOldListProc = (FARPROC) SetWindowLong(hWndList, GWL_WNDPROC, (DWORD)ListProc); //* Listbox subclass procedure LRESULT APIENTRY ListProc( HWND hWnd, UINT Message, WORD wParam, LONG lParam) { return CallWindowProc((WNDPROC)fpOldListProc, hWnd, Message, wParam, lParam); } with the same result. It is worse in Win2000 than in Win/98 but basically the same kinds of problems are there. In Win2000 the items the space below the bottom row in the listbox and below and to the right of the last row of items is not repainted as well as horizontal scrolling not working correctly. I've tinkered with this for a week and I'm at a loss. Any suggestions or pointers would be greatly appreciated. Thanks Neil Neil Lamka neil@meetingworks.com

    L 1 Reply Last reply
    0
    • N Neil Lamka

      I have an application that subclasses an LBS_OWNERDRAWFIXED listbox window. When I subclass the window it seems to break the listbox so that horizontal scrolling and painting do not work correctly (perhaps other things as well that I have not gotten to yet. Assuming that it was a problem with my subclass procedure I reduced it to the following code: //* The listbox definition in the dialog resource LISTBOX ID_USERS_LISTBOX, 3, 22, 324, 185, LBS_OWNERDRAWFIXED | LBS_MULTICOLUMN | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP //* Subclass the listbox earlier in the code.... fpOldListProc = (FARPROC) SetWindowLong(hWndList, GWL_WNDPROC, (DWORD)ListProc); //* Listbox subclass procedure LRESULT APIENTRY ListProc( HWND hWnd, UINT Message, WORD wParam, LONG lParam) { return CallWindowProc((WNDPROC)fpOldListProc, hWnd, Message, wParam, lParam); } with the same result. It is worse in Win2000 than in Win/98 but basically the same kinds of problems are there. In Win2000 the items the space below the bottom row in the listbox and below and to the right of the last row of items is not repainted as well as horizontal scrolling not working correctly. I've tinkered with this for a week and I'm at a loss. Any suggestions or pointers would be greatly appreciated. Thanks Neil Neil Lamka neil@meetingworks.com

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      http://support.microsoft.com/support/kb/articles/Q197/6/90.ASP http://msdn.microsoft.com/library/techart/msdn\_mfcclip.htm Also try to do the following: 1. send WM_SETREDRAW and turn off the drawing of the listbox before subclassing 2. Do subcalssing 3. send WM_SETREDRAW to turn drawing back on 4. in your ListProc add the following: if (Message == WM_NCDESTROY) { //return old window proc... SetWindowLong(hWnd, GWL_WNDPROC, (DWORD)fpOldListProc); } Mh2

      N 1 Reply Last reply
      0
      • L Lost User

        http://support.microsoft.com/support/kb/articles/Q197/6/90.ASP http://msdn.microsoft.com/library/techart/msdn\_mfcclip.htm Also try to do the following: 1. send WM_SETREDRAW and turn off the drawing of the listbox before subclassing 2. Do subcalssing 3. send WM_SETREDRAW to turn drawing back on 4. in your ListProc add the following: if (Message == WM_NCDESTROY) { //return old window proc... SetWindowLong(hWnd, GWL_WNDPROC, (DWORD)fpOldListProc); } Mh2

        N Offline
        N Offline
        Neil Lamka
        wrote on last edited by
        #3

        I finally had a chance to try your suggestion and it did not seem to help. Any other places you would suggest I look or things I should try? The strange thing (to me at least) is that reducing the subclass procedure to simply return the default procedure reply (as my example shows) results in the same problem. Thanks Neil Neil Lamka neil@meetingworks.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups