?
Solved

How can I change the header name of CListCtrl columns?

Posted on 2003-03-26
7
Medium Priority
?
465 Views
Last Modified: 2013-11-20
I add two columns named as "column1" and "column2" in CListCtrl controls using InsertColumn() in OnInitDialog() function. During the operation, I need to change name of the two columns to "order1" and "order2". How can I realize it?
Thanks!
0
Comment
Question by:BlueCoral
  • 4
  • 2
7 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 8217671
Ho BlueCoral,

you can use CListCtrl::GetHeaderCtrl() to retrieve a pointer
to the CHeaderCtrl class representating the header.

With this pointer you can use CHeaderCtrl::SetItem()
to change (beyond other thing) the text of a each column's
header.

Hint: take a look at help for CHeaderCtrl::GetItem() in MSDN ...
there you'll find a small sample code how to use these functions.

hope that helps,

ZOPPO
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 8217690
Sorry, allthough what I told you should work there's another
method without CHeaderCtrl.

There's a CListCtrl::SetColumn() which can be used nearly
the same way as CHeaderCtrl::SetItem() to modify column's
attributs.
0
 

Accepted Solution

by:
streetsmart earned 80 total points
ID: 8226766
     LVCOLUMN col;
     col.mask = LVCF_WIDTH | LVCF_TEXT ;
     col.pszText = "Text to change";
     col.cx = 60;
        m_List.SetColumn( 0, &col );

     col.pszText = "Text to change";
        m_List.SetColumn( 1, &col );
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:BlueCoral
ID: 8242697
Thanks to all!
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 8243556
I really hate it ... what is the new info streetsmart told
you which I didn't tell before? I told you the functions to
use and streetmart simply put some sample code around and
therefore earns the points !?

That's annoying ... I don't know why I waste my time with this...
0
 

Author Comment

by:BlueCoral
ID: 8243778
Hi Zoppo:
I am so sorry. I am really grateful to your kindness. And your answer is very helpful to me.
I am a new commer here and not very familiar with the rules here. If I can, I want to share the points to you and streetsmart!
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 8243911
Well, I don't care about the points ... it's just a matter of
manners ... people here don't get any value for their (often
very good) help - I think there's no other place in the
whole net where you can get such fast help - only thing experts
here insist on is good (fair) behavior.

If, in future, you want to share points you can do by asking
a question like 'please share points for Q_... between this and that experts' in EE Community Support ... the EE site-
operators the will do it:
http://www.experts-exchange.com/Community_Support/

Further you could read the 'Tips on Questions, Comments and
Answers' at: https://secure.experts-exchange.com/jsp/cmtyQuestAnswer.jsp

ZOPPO
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Integration Management Part 2
Suggested Courses

621 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