Solved

What is the column width in a list control after double click on header

Posted on 2004-10-18
7
521 Views
Last Modified: 2013-11-20
List control in report style.  I double click on the separator and the column is resized automatically.

I trap the HDN_DIVIDERDBLCLICK in a class derived from CListCtrl (notify message).  
I get the event BUT the width of the column is that BEFORE the double click.  I have passed the event onto the ListCtrl base class before querying the header for the new width.  I have even tried to strip out pending messages in the queue before getting the column width from the header - no effect.
Trapping the HDN_ENDTRACK notify message doesn't help either.

How can one respond to the double click event of the header and get the new column width?
0
Comment
Question by:AndyAinscow
7 Comments
 
LVL 14

Assisted Solution

by:RichieHindle
RichieHindle earned 100 total points
ID: 12342411
If all else fails, use RegisterWindowMessage to register a private message, and post (not send) yourself one of those when the event happens.  Then in the handler for that message (which you set up using ON_REGISTERED_MESSAGE), look up the width and act upon the change.  By the time your message gets delivered, Windows will have sorted itself out and will report the correct width.
0
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 300 total points
ID: 12344768
What about HDN_ITEMCHANGING?
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 12344780
plz check http://codeproject.com/listctrl/headerctrl.asp - "Using the Header Control"

~R
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 23

Expert Comment

by:Roshan Davis
ID: 12344799
and one more, this describes the usage of ENDTRACK message
"Autofit Header Control"

http://www.codeguru.com/Cpp/controls/listview/headercontrol/article.php/c927/

~R
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 100 total points
ID: 12346758
You can test the width of an individual cell, not the in the header.
0
 
LVL 44

Author Comment

by:AndyAinscow
ID: 12347523
RichieHindle - sounds good, not tested it.
jaime_olivares - correct about the width of a cell, unfortunately when I get the HDN_DIVIDERDBLCLICK the cell width is apparently still the same as the width in the header.
roshmon - some good links but I couldn't find anything new that helped directly.  However the HDN_ITEMCHANGED (not HDN_ITEMCHANGING) turned out to be my solution.  This event was fired with the correct width after resizing.  I needed to 'protect' my routine with a bool flag as I only wanted it to run after the drag/resize was finished.  The HDN_ITEMCHANGED was pumped many times during the drag resize but I could also trap the start of the drag and set a flag, release the flag at the end drag.
0
 
LVL 14

Expert Comment

by:RichieHindle
ID: 12347705
Andy: Thanks for the summary, and for splitting the points.  If only everyone on EE were as thoughtful, it would be a better place.  8-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 171
abstract class with all non abstract mentods 6 76
changeXy challenge 13 67
Annoying "thing" blocks my view 4 82
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now