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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Resizing column in list control

Resizing column in list control

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 2 Posters 1 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.
  • J Offline
    J Offline
    jayshml
    wrote on last edited by
    #1

    Hi, when you resize a column in list control which event gets triggered?

    V 1 Reply Last reply
    0
    • J jayshml

      Hi, when you resize a column in list control which event gets triggered?

      V Offline
      V Offline
      Vancouver
      wrote on last edited by
      #2

      OnBegintrack and OnEndtrack

      J 1 Reply Last reply
      0
      • V Vancouver

        OnBegintrack and OnEndtrack

        J Offline
        J Offline
        jayshml
        wrote on last edited by
        #3

        How to add those event handlers?

        V 1 Reply Last reply
        0
        • J jayshml

          How to add those event handlers?

          V Offline
          V Offline
          Vancouver
          wrote on last edited by
          #4

          BEGIN_MESSAGE_MAP(GridClass, CListCtrl) //{{AFX_MSG_MAP(yourclass) ... //}}AFX_MSG_MAP ON_NOTIFY(HDN_BEGINTRACKA, 0, your_OnBegintrack) ON_NOTIFY(HDN_BEGINTRACKW, 0, your_OnBegintrack) ON_NOTIFY(HDN_ENDTRACKA, 0, your_OnEndtrack) ON_NOTIFY(HDN_ENDTRACKW, 0, your_OnEndtrack) END_MESSAGE_MAP() Note, that the control id of the CHeaderCtrl in CListCtrl is always zero; thus, the second parameter (that is the control filter) in the ON_NOTIFYs is zero. The "A" and "W" versions are for ANSI and UNICODE (Wide) environment; in any given program run, only one or the other will become active. Btw, OnBegintrack receives control, when the user grabs the right-side divider of a column with the mouse (starting resizing). OnEntrack receives control, when the user releases the divider. The parameters are: void yourClass::your_OnBegintrack(NMHEADER *nmheader, LRESULT* pResult) void yourClass::your_OnBegintrack(NMHEADER *nmheader, LRESULT* pResult) (*nmheader).iItem is the column index from zero. *pResult should be set to TRUE if you don't allow resizing (TRUE indicates, that you processed the event completely), and FALSE, if you want MFC to finalize resizing.

          J 1 Reply Last reply
          0
          • V Vancouver

            BEGIN_MESSAGE_MAP(GridClass, CListCtrl) //{{AFX_MSG_MAP(yourclass) ... //}}AFX_MSG_MAP ON_NOTIFY(HDN_BEGINTRACKA, 0, your_OnBegintrack) ON_NOTIFY(HDN_BEGINTRACKW, 0, your_OnBegintrack) ON_NOTIFY(HDN_ENDTRACKA, 0, your_OnEndtrack) ON_NOTIFY(HDN_ENDTRACKW, 0, your_OnEndtrack) END_MESSAGE_MAP() Note, that the control id of the CHeaderCtrl in CListCtrl is always zero; thus, the second parameter (that is the control filter) in the ON_NOTIFYs is zero. The "A" and "W" versions are for ANSI and UNICODE (Wide) environment; in any given program run, only one or the other will become active. Btw, OnBegintrack receives control, when the user grabs the right-side divider of a column with the mouse (starting resizing). OnEntrack receives control, when the user releases the divider. The parameters are: void yourClass::your_OnBegintrack(NMHEADER *nmheader, LRESULT* pResult) void yourClass::your_OnBegintrack(NMHEADER *nmheader, LRESULT* pResult) (*nmheader).iItem is the column index from zero. *pResult should be set to TRUE if you don't allow resizing (TRUE indicates, that you processed the event completely), and FALSE, if you want MFC to finalize resizing.

            J Offline
            J Offline
            jayshml
            wrote on last edited by
            #5

            No this is not working? Actually I want to resize a control in list subitem as I increase or decrease column width.I am handling this in OnCustomDraw() but it is flickering.I want to set SetRedraw() to TRUE and FALSE but in which event should I do that?

            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