Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

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

Posted on 2004-10-18
7
Medium Priority
?
570 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 14

Assisted Solution

by:RichieHindle
RichieHindle earned 300 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 900 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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
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 300 total points
ID: 12346758
You can test the width of an individual cell, not the in the header.
0
 
LVL 45

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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

647 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