CListCtrl titles

Hello,

I am working with a CListCtrl control in my VC++ app. I defined some 
columns o be displayed in the control. But I have been looking at the 
MSDN and did not find a way to set a title to every displayed colum in 
the CListCtrl. How can I do that ? Is there a way also to change the 
color of this title, as the backcolor of my list is black and I would 
like to display the titles in white ?

Thank you for any help.

-- 
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net

0
4/5/2005 12:43:48 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
568 Views

Similar Articles

[PageSpeed] 14

ByB wrote:
> Hello,
> 
> I am working with a CListCtrl control in my VC++ app. I defined some 
> columns o be displayed in the control. But I have been looking at the 
> MSDN and did not find a way to set a title to every displayed colum in 
> the CListCtrl. How can I do that ? Is there a way also to change the 
> color of this title, as the backcolor of my list is black and I would 
> like to display the titles in white ?
> 
> Thank you for any help.
> 

Look at SetColumn method in CListCtrl. It takes LVCOLUMN struct as parameter
where you can set the text (remember to set flags right). Other way to do that
is to get pointer to CHeaderCtrl and set text by calling SetItem method.
To change the background, you have to draw the header control yourself. Just 
override DrawItem event handler in header control.
0
4/5/2005 7:48:53 PM
Il se trouve que Asko Telinen a formul� :
> ByB wrote:
>> Hello,
>> 
>> I am working with a CListCtrl control in my VC++ app. I defined some 
>> columns o be displayed in the control. But I have been looking at the MSDN 
>> and did not find a way to set a title to every displayed colum in the 
>> CListCtrl. How can I do that ? Is there a way also to change the color of 
>> this title, as the backcolor of my list is black and I would like to 
>> display the titles in white ?
>> 
>> Thank you for any help.
>> 
>
> Look at SetColumn method in CListCtrl. It takes LVCOLUMN struct as parameter
> where you can set the text (remember to set flags right). Other way to do 
> that
> is to get pointer to CHeaderCtrl and set text by calling SetItem method.
> To change the background, you have to draw the header control yourself. Just 
> override DrawItem event handler in header control.

Thank you very much.   :-)

-- 
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net

0
4/6/2005 8:00:02 AM
Reply:

Similar Artilces:

CListCtrl Header height change??
CListCtrl Header height change?? Is it possible to change the height of a CListCtrl Header.? Thanks Markus ...

Change case from UPPER to Title Case??
Check out the PROPER function -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS "Mamacsee" <Mamacsee@discussions.microsoft.com> wrote in message news:6D267BBF-1911-4F74-BFFE-D66E46C17554@microsoft.com... > You can use =Proper(a1) to change cell A1 from upper case to "title" case. ******************* ~Anne Troy www.OfficeArticles.com www.MyExpertsOnline.com "Mamacsee" <Mamacsee@discussions.microsoft.com> wrote in message news:6D267BBF-1911-4F74-BFFE-D66E46C17554@microsoft.com... > ...

CTreeCtrl and CListCtrl problem
I use create a single document struct using MFC(explore style).The left of the window is CLeftView class(which inherit CTreeView).The right is CBrowserView which inherit CListView.I want to display the content of a directory in the right(CListview) when user click the item of the ctreectrl. In the LeftViw I add method "void CLeftView::OnClickItem (NMHDR* pNMHDR, LRESULT* pResult)" because I want to know which item be clicked by user. ////////////////Leftview////////////////////// CTreeCtrl& mtree=GetTreeCtrl(); HTREEITEM item=mtree.GetSelectedItem(); data=mtree.GetItemDat...

Problems with CListCtrl
I'm having trouble with a CListCtrl object. I'm trying to automatically set the selected items of the list from my code. I try the following statement: m_List.SetItem (pos, 0, LVIF_STATE, NULL, 0, LVIS_SELECTED, LVIS_SELECTED, 0); The SetItem function returns non-zero, which supposedly means it was successful. However, I don't see any selection showing up. I even called RedrawItem on this list item, but it didn't help either. Anyone know about this? -Eric >I'm having trouble with a CListCtrl object. I'm trying to automatically >set the selected ite...

Titles on worksheets
How do I get a title to be printed on the top of the worksheet? For instance, Attendance, January - March, 2005 Click File > Page Setup > Header/Footer tab > Custom Header Place the cursor within the desired section (Left - Centre - Right) and then put the header there, eg: Attendance, January - March, 2005 Click OK > OK -- Rgds Max xl 97 --- GMT+8, 1� 22' N 103� 45' E xdemechanik <at>yahoo<dot>com ---- "PSSHR" <PSSHR@discussions.microsoft.com> wrote in message news:5941352C-346A-4D93-95BD-C486FC9F137F@microsoft.com... > How do I get a ti...

CListCtrl and sub item editting
Hi, Is it possible to implement CListCtrl sub item editting without creating a custom ctrl? I am using VS2003. TIA Tony >Is it possible to implement CListCtrl sub item editting without creating a >custom ctrl? Tony , There's no built-in support for this, so no, you have to provide some implementation for this. Have a look on sites such as CodeGuru and CodeProject, they'll have examples. Dave Thanks Dave, I've seen examples, I just wasnt sure if I needed my own ctrl. Regards Tony "David Lowndes" <DavidL@example.invalid> wrote in message news:k...

Title Block as a header?
I'd like to create header with my company title block. It was very eas to do in Word, but it doesn't look like the header function works th same way in Excel. Is there a way to use the draw function and impor pictures into the header like you do in Word -- mae177 ----------------------------------------------------------------------- mae1778's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2571 View this thread: http://www.excelforum.com/showthread.php?threadid=39225 xl2002 added support for pictures in the header (and footer). Or you could put the p...

Title Field
Is it possible to change the column type of the 'Title' field in my SharePoint list for example, to a 'Choice' field? I don't really need a 'Title' field, but of course I need to have the 'Edit menu' option on one of the fields, and I don't want it to be a 'single line of text'. Any help would be appreciated. -- Thanks, Rob E. I wouldn't recommend messing with the title column. It's a system column and it's better to be left alone. What you can do however: 1) Hide the Title column See: http://ferraradata.co...

How to add clistctrl into clistctrl?
How to clistctrl into a clistctrl? For example like adding checkbox , combobox, i want to add clistctrl into a clistctrl ...

CListCtrl::InsertItem strange behaviour?
Hi everyone, I have a dialog with a couple of ListCtrl on it. I'm filling them up with information when the dialog initializes. Therefore i have two loops, one for each ListCtrl, on both loops I use the same function to insert the items: myListCtrl1.InsertItem(0, anyString); --- myListCtrl2.InsertItem(0, anyString); The weird thing is : the first loop InsertItem is always inserting the Item on the first position (InsertItem returns a 0 always); displacing the previous inserted item. BUT, the second loop InsertItem is always inserting the item on the last position (InsertItem retu...

icons on 2nd column of a clistctrl
hi, Is it possible to have icons or bitmaps on all of the columns of a clistctrl, not only the 1st column ? thanks, "behzad" <behzadnn@yahoo.com> wrote in message news:#LE9$vvYDHA.2284@TK2MSFTNGP12.phx.gbl... > hi, > Is it possible to have icons or bitmaps on all of the columns of a > clistctrl, not only the 1st column ? Never tried it personally, but according to the LVM_SETITEM documentation... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listview/messages/lvm_setitem.asp "In version 4.70 and later, you can se...

Tooltip in CListCtrl
Hi all I have been trying now for a couple of days to figure out a way to display a tooltip over individual items in a CListCtrl. My control is in Report style, and has two columns where the first contains keys, and the second values. Problem is the keys do not have a lot of room, and I would like a tooltip to give a better description of what the key actually refers to. I found an article on Codeguru describing how this could be done, but I did not work for me - my override of CWnd::OnToolHitTest was never called by the framework as the article stated it would... For all I know this article...

CListCtrl questions
Hi, I am developping on Pocket pc and smartphone and I have a few questions about CListCtrl in report mode. First how can I know how many items I can display without having a vertical scrollbar? On smartphone we are using keypad to move, so first time when I press down key, the curent selection doesn't move.It's only the second time I press the key that is starts to move. First I thought it was a focus problem but even with the focus, it still the same. I also tried to select the first line first with a setitemstate but same result.any idea ? Last question is once a clistctrl h...

SetItemHeight in CListCtrl
Is there a way for me to set the height of all the items in a CListCtrl? I am trying to overlay one of the columns in an item with a CComboxBox and the minimum height in the comboBox appears to be greater than the height of the item in the CListCtrl. Brian Westcott wrote: > Is there a way for me to set the height of all the items in a CListCtrl? I > am trying to overlay one of the columns in an item with a CComboxBox and the > minimum height in the comboBox appears to be greater than the height of the > item in the CListCtrl. > > You have to create OWNERDRAW CLi...

Displaying JPEG images in CListCtrl
Hi All, I am writing an application in which I want to display a set of JPEG images into a CListCtrl. Is there a way of doing this by using just MFC? Awaiting for your reply Thanks & Regards Sachin Bhave > I am writing an application in which I want to display a set of JPEG > images into a CListCtrl. Is there a way of doing this by using just MFC? Try codeguru/codeproject for something like this. Here is one that should get you started: http://www.codeproject.com/listctrl/thumbnailview.asp --- Ajay ...

CListCtrl
I have used LVS_EX_CHECKBOXES extended style for my CListCtrl. Do Parent Window/Dialog receive any notification message when user set/reset the checkbox. I tried to use NM_CLICK , but checkbox value is changed after this notification is processed. ...

CListCtrl Item Selection Questions
Hi I want to ask several things about CListCtrl here: 1. How to disable multiple item selection? 2. How to disable the column header click? Since I don't have any sorting facility in my application. Thank you very much. Select the ListCtrl object in resource editor and set the following properties Single Selection True No Sort Header True Cheers Check Abdoul --------------------- "Landon" <Landon@discussions.microsoft.com> wrote in message news:589C8584-BE50-4BA0-AA56-58297A072FC3@microsoft.com... > Hi I want to ask severa...

Unable to use CListCtrl.FindItem after CListCtrl.SortItems
I have a CListCtrl which I want to sort, but after I sort I can no longer use FindItem because it always returns a failure. Any assistance with this is greatly appreciated. Thanks! >I have a CListCtrl which I want to sort, but after I sort I can no longer >use FindItem because it always returns a failure. Any assistance with this >is greatly appreciated. Show a concise code example of what you're doing then someone may be able to point out what's wrong. Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq LVFINDINFO findinfo; findinfo.flags=LVFI_STRING; findinfo.ps...

Problem with CListCtrl::HitTest
Hi all... I'm programming a Custom Drawn List Control. The problem is when I add a handler for ON_WM_LBUTTONDOWN. This is the code I have in it: void CMyGrid::OnLButtonDown(UINT nFlags, CPoint point) { LVHITTESTINFO ht; ZeroMemory(&ht, sizeof(LVHITTESTINFO)); ht.pt = point; HitTest(&ht); CListCtrl::OnLButtonDown(nFlags, point); } After the call to HitTest, these values are contained in the structure: pt = {x=177 y=179} flags = 1 iItem = -1 iSubitem = 0 regardless I click on an item or not. To know the item and subitem where the click occures, I can use a loop, I think, ...

CListCtrl ?
I was wondering if there is an equivalent statement for the CListCtrl to select a particular? Something like SetCurSel(item number) in a CListBox? What I want is to highlight the insert item and have the list scroll down so that the current item that was inserted is always visible. As it is now the top of the list is always visible. Z.K. You can use SetItemState() and EnsureVisible() to do what you're trying to do. Something like: m_MyList.InsertItem(nItem,_T("New Text For This Item"); m_MyList.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED); m_MyL...

how to have my titles move down as i scroll down the page
hi what i want to do is have the top line of the exel sheet move down the page and stay in veiw so i can easily see which field i am currently woorking on. can anyone tell me how to do this? yours david Click on the last row of heading (or row 1 if there is just one row) Use Windows Freeze best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "DAVIDPEOVER" <DAVIDPEOVER@discussions.microsoft.com> wrote in message news:7F17D28F-2A71-437B-BF81-AEEB9D880B15@microsoft.com... > hi what i want to do is have the top line of the exel sheet move...

Creating a CListCtrl
I'm creating a CListCtrl manually to be added to a tabbed window. I have the line: m_listCtrlArtifacts->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT, CRect(20,20,200,200), &m_outBar, IDGT_PROJ_LIST_ARTIFACTSLIST); MSDN help page - http://msdn2.microsoft.com/en-us/library/zdff988k.aspx - seems like I have all parameters valid, but the problem is that at runtime this gives me an unhandled exception. Any suggestions? > I'm creating a CListCtrl manually to be added to a tabbed window. I have the > line: > > m_listCtrlArtifacts->Create(WS_CHILD|WS_VISIBLE|...

CListCtrl?
Can anyone tell me how to save the items in a CListCtrl to a file and then to load it when the dialog is opened? Thanks in advance I think this already got answered, but this is a new thread so: I would use CStdioFile and simply write the file out as comma separated values like: "Name","Address","Company" or, alternatively, you could store the items in an object list and serialize it to disk if you don't need the file to be readable by outside programs or people. Then, when you want to reload the list control you read and parse the file and write th...

Right clicking on a CListCtrl item
I have a TreeCtl object in a dialog box. I created an OnNMRclick.. override function to capture a right clicks. The problem I can't figure out is how to find the tree item that the user has right clicked on. Here's what I tried: void CRestoreFiles::OnNMRclickXYZ(NMHDR *pNMHDR, LRESULT *pResult) POINT CurPos; TVHITTESTINFO lpht; HTREEITEM RightClickItem; GetCursorPos(&CurPos); lpht.pt = CurPos; RightClickItem = TreeView_HitTest(pNMHDR->hwndFrom,&lpht); ... I figured that GetCursorPos would give me the position of the cursor where I had right clicke...

Changing Title of Email Window
Hi, I am new to CRM 4.0 and I have a requirement where the customer wants me to customize the Email Window's Title bar and change the "Create New Email" text that appears on the title bar to a custom message. Can I do that? Some pointers will be really helpful. Thanks Rahul Submitted via EggHeadCafe - Software Developer Portal of Choice WPF Custom Validation Using the Enterprise Library http://www.eggheadcafe.com/tutorials/aspnet/9af7ac1a-d7f3-4e00-9aec-33ef1ec7d1a3/wpf-custom-validation-usi.aspx Hi Rahul , Yes, You can change the message through customization. Go to "...