?
Solved

How can I change the header name of CListCtrl columns?

Posted on 2003-03-26
7
Medium Priority
?
394 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
[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
  • 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 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