Solved

Hide a column in a CListCtrl

Posted on 2002-07-25
13
2,246 Views
Last Modified: 2013-11-20
Hi,
I have a CListCtrl which I want to hide columns in it.
I set the width of the column to zero, but this is not good enough because can be easially break by dragging the splitter.

Does anyone have any idea of how to it right ??
An example would be graet...

thanks,
Yoav.
0
Comment
Question by:yoavo
[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
  • 4
  • 3
  • 2
  • +3
13 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 7176966
What about deleting the column from the list control when not required?
0
 

Author Comment

by:yoavo
ID: 7176989
no.
I need to hide or show it on demand
0
 
LVL 12

Expert Comment

by:migel
ID: 7177032
Hi!
may be set column width  equal to 0 will help?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:yoavo
ID: 7177044
Thats what I did !!!
read my question !!!
0
 
LVL 12

Expert Comment

by:migel
ID: 7177063
hmm sorry
but you can catch WM_MOTIFY message from the header control
and restrict this situation:
HDN_BEGINTRACK
return TRUE to prevent divider tracking.
to do this you have to derive your own class from CListCtrl  
0
 
LVL 12

Expert Comment

by:migel
ID: 7177065
hmm sorry
but you can catch WM_MOTIFY message from the header control
and restrict this situation:
HDN_BEGINTRACK
return TRUE to prevent divider tracking.
to do this you have to derive your own class from CListCtrl  
0
 

Author Comment

by:yoavo
ID: 7177101
I tried to do so, but I have the following problem:
Now I have 2 columns on the same devider (one with some width and the other with width = 0) and if a user trys to resize the column, he can to so only if the cursor position is from the left side of the devider !!!
if the cursor is from the right then the resize operation is blocked !
0
 
LVL 12

Expert Comment

by:migel
ID: 7177222
ok
you can move column to the last position so none can resize  rightmost column :-)
see  HDM_SETORDERARRAY
0
 
LVL 37

Expert Comment

by:zzynx
ID: 7179405
Hi,
I have an app where the user can determine which columns he wants to see (and in which order).
When the dialog in which he made his choice closes,
I delete all the existing columns [DeleteColumn()] and add again the ones he chose to see.
It works perfect.

Success.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 7179408
Of course you also have to repopulate your listcontrol afterwards.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 7179417
Further to my first post.  Recreate the column again if required.
0
 
LVL 1

Accepted Solution

by:
poohbear_68 earned 50 total points
ID: 7181912
I suggest you move it to the far left, set the width to zero, and then use migel's suggestion to prevent divider tracking.  Nobody will ever want to resize anything on the left hand size anyway....
0
 

Expert Comment

by:exchnerd
ID: 21559127
Alternatively, you can set pResult = 1 and return if you are not deriving your class from CListCtrl
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

615 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