Highlight a line in a CListCtrl

I want to highlight a line in a CListCtrl via the code and cant find a member 
function to do this.

Anyone know?
0
ChrisBaker (163)
4/5/2007 10:46:01 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
528 Views

Similar Articles

[PageSpeed] 4

>I want to highlight a line in a CListCtrl via the code and cant find a member 
>function to do this.

Chris,

By highlight, do you just mean the normal selection state? If so, just
use SetItemState with LVIS_SELECTED.

Dave
0
davidl7375 (2060)
4/5/2007 12:07:10 PM
and you may require to set this list view extended style to highlight items 
and subitems (full line) through SetExtendedStyle

LVS_EX_FULLROWSELECT

"David Lowndes" <DavidL@example.invalid> wrote in message 
news:9gp913dspm6mprunai829jeg5qido7fsml@4ax.com...
> >I want to highlight a line in a CListCtrl via the code and cant find a 
> >member
>>function to do this.
>
> Chris,
>
> By highlight, do you just mean the normal selection state? If so, just
> use SetItemState with LVIS_SELECTED.
>
> Dave 


0
mubi (158)
4/5/2007 1:23:53 PM
m_List.SetItemState(nIndex,LVIS_SELECTED,LVIS_SELECTED);

Keep in mind that with listcontrols the selection will not be displayed 
unless the control has focus. Unless you set the Always Show Selection flag. 
(LVS_SHOWSELALWAYS)



AliR.

"Chris Baker" <ChrisBaker@discussions.microsoft.com> wrote in message 
news:59E281A0-DDBC-4B1B-BA29-F4B0FE28B8FD@microsoft.com...
>I want to highlight a line in a CListCtrl via the code and cant find a 
>member
> function to do this.
>
> Anyone know? 


0
AliR3470 (3236)
4/5/2007 3:32:23 PM
In addition to what the others have suggested, take a look at this:

http://www.codeproject.com/listctrl/coloredlistctrl.asp

Tom

"Chris Baker" <ChrisBaker@discussions.microsoft.com> wrote in message 
news:59E281A0-DDBC-4B1B-BA29-F4B0FE28B8FD@microsoft.com...
>I want to highlight a line in a CListCtrl via the code and cant find a 
>member
> function to do this.
>
> Anyone know? 

0
tom.nospam (3240)
4/5/2007 4:16:09 PM
Reply:

Similar Artilces:

CListCtrl edit labels problem
Hi there, I have a list (CListCtrl derivate) which uses the LVS_OWNERDATA (for speed), LVS_REPORT and LVS_EDITLABELS styles. Everything works OK except for the edit labels. At the end of editing (in LVN_ENDLABELEDIT notification message) all the time the item.pszText member is NULL as I canceled the edit. I can start the edit session (I don't call anything special, I let the system start it) but when I press ENTER the notification message tells me the edit "was canceled". I cannot get the text entered in the edit label. It's possible that LVS_EDITLABELS doesn't wo...

Display message details on 1 line when using Preview Pane on right
Hi there. When viewing messages with the Preview Pane on the right, Entourage only shows the From and Date on one line (with TONS of whitespace between them) and then on a second line shows the subject. I'm not using grouping here, I'm just trying to show as many messages as possible so I can see my whole inbox at one and view the selected message on the right. This works fine in Outlook... Help! -- matthh On 11/17/09 8:49 AM, in article 18d7a806-4b2c-4d4c-977f-256fe4496cb8@g22g2000prf.googlegroups.com, "matthh" <matthh@gmail.com> wrote: > Hi there. Whe...

How to print (not) grid lines?
When I print Excel Worksheets then sometimes the gridlines are printed and sometimes not. How can I enable/disable printing grid lines? Claudia Page Setup > Sheet - Gridlines. -- Regards Dave Hawley www.ozgrid.com "Claudia d'Amato" <clauama@wonderworld.com> wrote in message news:4bc9534a$0$6886$9b4e6d93@newsspool2.arcor-online.net... > When I print Excel Worksheets then sometimes the gridlines are printed and > sometimes not. > > How can I enable/disable printing grid lines? > > Claudia > ...

Create line in chart by filling the serie collection with only 1 value?
Hi everybody, :) Is it possible to create a line in a chart based on ONE value? (to occupy the Series Collections) I�m creating an application that created dynamic charts of the sourc data in an Excel database. This Data is filtered on several criteri and has dynamic name ranges to fill the Charts Series Collections an so create the specific charts. Everything works like a charm but I have a lot of Constants of only ON value. (these are Specifications to make the chart readable) Normally I would fill a column with these values en the have my lin anyway. But because I have more than 150 ...

Extra line feeds in received mail
Why is it that mail received using Outlook Express (and Windows Vista Mail) add extra line feeds to every line in incoming mail? How to I make it stop? When I send the same message to other programs (e.g., Outlook, webmail) the formatting remains as originally sent. OE (and WinMail) interprets a <P> in HTML as a double line feed and <BR> as a single line feed. Some programs such as Word generate a <P> when one uses the Enter key and a <BR> when one uses a Shift-Enter. So if the user uses the Enter key, then the recipient will see a double line feed if t...

In Excel 2007 chart with multiple lines, mouse doesn't track lines
If I open an Excel 2003 x-y scatter line chart with multiple (x,y) line graphs (or open a graph that was saved under Excel 2007), and I move the mouse over the various lines (some of them may be close to each other) then there is an x 'offset' in the location of the mouse and when Excel recognizes a line graph and displayes the line title with a little message underneath the mouse cursor. Another way to explain thsi behaviour is if you try to click at a particular line graph, it may not select it, it may select a different line graph that is located left to where the mouse is. ...

importing a .csv so data on new lines?
I have a csv file. The data is separated by commas and each record is on a new line. Is there any way to import the data into Word so that the data that is separated by commas in the csv appears on a new line within Word while each record is separated by a blank line? Here is one option. '-------------------------------------------------------------- Sub SpecCSVimport() Const ForReading = 1 Dim strPath As String Dim strLine As String Dim i As Integer Dim arrFileLines() As String Dim arrOneLine() As String Dim fso strPath = "C:\Test\My CSV.csv" S...

Print X number of lines per page in a report
I have a report to print a Purchase Order. The report have a subreport (OrderDetails). I would like to print this report with a maximum of 15 records(lines) per page. For example, if i have an order with 30 items i would like the report to print 15 items in page 1 and the resting 15 items in page 2. any ideas? Thanks, Troper Duane Hookom wrote: >Have you tried setting the height of the subreport to 15 items and not >allowing it to grow? >> I have a report to print a Purchase Order. The report have a subreport >> (OrderDetails). I would like to print this report with a ...

help with line graph
i accidently and unknowingly tuned off the line on my line graph, when i try to do the line graph the line isn't there. please help!!!!!!!!! Can you see the markers on the chart? If so right click one, select Format Data Series; on the Pattern tab put check mark next to Line If you cannot see it; click on chart, tap up/down arrows watching Name box, when Series 1 show up, use menu item Format. -- Bernard Liengme www.stfx.ca/people/bliengme remove CAPS in e-mail address "darci" <anonymous@discussions.microsoft.com> wrote in message news:149a201c3f8f9$4cf70c70$a601280a@...

My cursor disappears when I enter at end of line
When I am typing in word my cursor dissappears after I 'enter' at the end of a line and if i try to tab across I cannot see where I am before I start typing again. Its driving me round the bend. Any help would be appreciated. Does this happen anywhere within the text? -- Stefan Blom Microsoft Word MVP "billyboy1945" <billyboy1945@discussions.microsoft.com> wrote in message news:DB3BFC58-D388-4297-9E08-9A7828229CEA@microsoft.com... > When I am typing in word my cursor dissappears after I 'enter' at the end > of > a line and if i ...

how do I enter multiple lines in a cell in Excel
asowles, try Alt+enter, is this what you want? -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "asowles" <asowles@discussions.microsoft.com> wrote in message news:D44E20D0-8CD7-4E65-9578-995E3F294EFA@microsoft.com... > ...

text boxes that label axes in line/scatter graphs
I tried to use "SAT-M" as y-axis label, but "M" was cut off (actually went to second line that could not be seen). I tried every trick I know to lengthen the text box, to fit label on one line. Hi, The only way to length chart textboxes is with more text. But at some point more text will cause the content to wrap. The charts textboxes do not have the ability to be sized manually even though the bounding box and grab handles would suggest otherwise. Try adding a few spaces or even non-breaking spaces ALT+0160 (Numpad) Cheers Andy Peg wrote: > I tried to use &qu...

updating line items in econnect
econnect seems to allow me to change detail records insode of an order. However, if I change the item number or the line number, I get an error. Am I limited to only changing quantities/prices or is there a way to change everything in the detail? ...

CListCtrl with 2 Headers OR howto scroll CHeaderCtrl
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I try to implment a ListBox in a dialog like this: | | Group1 | Group2 | Group3 | <- TopHeader | Date | Temp | Humid | Temp | Humid | Temp | Humid | <- DataHeader +------+------+-------+------+-------+------+-------+ | 1/1 | 20 | 50 | 21 | 51 | 19 | 52 | <- Data ... TopHeader is (at the moment) a CHeaderCtrl DataHeader + FData is a CListCtrl I tried to place a CHeaderCtrl (TopHeadeR) above a CListCtrl (DataHeader+Data). Which works fine, except the case of scrolling. When I catch the Scrol...

Highlight Old Days in Outlook?
With the latest version of Outlook 2003 is there anyway to highlight days. Would like to highlight days that have passed to make it a bit easier to read. No. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Author, Google and Other Search Engines (Visual QuickStart Guide) Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com Join OneNote Tips mailing list: http://www.onenote-tips.net/ "Al Franz" <albert@nospam.netmation.com...

Selecting a CListCtrl dynamically (SetItemState)
Can anyone 'guess' why the following 2 lines don't select an item in my list any more. It worked when I tested it a few months ago, but now it doesn't do/select anything! There is no scroll bar (room for all items in my list) and nothing is selected when I do these 2 lines: SetItemState(rowToSelect, LVIS_SELECTED, TRUE); EnsureVisible(rowToSelect, FALSE); The list is not the active window, but they should still appear selected (in grey). Perhaps I have missed a setting to do with selections being visible? My creation line for the lists is: m_listCtrlSoftware.Create(W...

skipping lines
Does anyone know how to highlight every other line easily - a master stroke instead of control + click on lines? Sometimes I want to color alternate lines. You could do this: 1. Press Ctrl+A. 2. Format > Conditional Formatting 3. Select "Formula Is" and insert: =MOD(ROW(),2)=0 4. Press the "Format" button, select Pattern tab, and choose a color. HTH Jason Atlanta, GA >-----Original Message----- >Does anyone know how to highlight every other line >easily - a master stroke instead of control + click on >lines? Sometimes I want to color alternate l...

CEditCtrl with automatic line feed
Hello NG, I hope someone can help. I already have been searching in the web but without success. I use a CEditCtrl, in which one can input several lines. When the input reaches the border, I want the text to "jump" into the next line, so that the user is not supposed to scroll (like here in my mail editor e.g.). Do you know if such a EditCtrl exists or how I can do it? Thanks in advance Guido "Guido Franzke" <guidof73@yahoo.de> wrote in message news:eZcKcnTbHHA.4720@TK2MSFTNGP04.phx.gbl... > Hello NG, > > I hope someone can help. I already have been se...

Extra Blank Lines
The following macro imports a text file and sorts horse races in time order and puts a blank line in between each race time (which is at the end of the code), which it does admirably. I had some valuable help with this project from group members recently. However, it does create quite a few blank lines en bloc. It's not really a problem, as I search them out and do a delete. Below is the code which a member might use in order to find the cause of the blank lines? Sub Macro1() Range("A2:J601").Select Selection.ClearContents Range("A2").Select ...

Blank lines in replies
Hi When I reply or forward Outlook (2002, SP3) I've started getting about 16 blank lines inserted into the message I'm replying to, between the 'Subject:' line and the start of the message I'm replying to. Any ideas why this might be, and what I can do to stop it? Thanks David ...

I have cox cable no phone line, And Eatel Phones
I would love to have outlook express but I only have cox cable and Eatel phone line so there is no way to get it if so please let me know. Barbara Alexie <Barbara Alexie@discussions.microsoft.com> wrote: > I would love to have outlook express but I only have cox cable and > Eatel phone line so there is no way to get it if so please let me > know. Ask in an Outlook Express newsgroup. OE will work fine with Cox cable. -- Brian Tillman ...

How can I shutdown Outlook 2003 from the command line ?
I maintain my PST files on an encrypted volume, which is locked for backup purposes as long as OL is running. I have batch file that I run my backup routine from, but I need to shutdown Outlook before doing the backup so I can then dismount the virtual voume and backup the volume file. How can I shutdown Outlook from the coomand line ? KILL seems a bit drastic, scared it will leave things a mess. Thanks, Scott There is no command line option, but this WSH/VBScript file might work. Set objOutlook = CreateObject("Outlook.Application") objOutlook.Quit Set objOutlook = Nothing ...

How to insert ALT+ENTER (new line) with Replace
Hi All, I am trying to find a way or inserting ALT+ENTER (new line) in certain places in text strings in cells. In MS Word this is done using the replace command (just replace a given character with "^l" - voila). In Excel, I'd also like to replace all "#" characters I have in cells that only have text with the equivalent of "^l" (ALT+ENTER) to create a new line in the cell Can anyone help or point to where I may find help? Thanks a lot, JS Edit>replace, find what # replace with char 10 do as follows, after you have entered the number sign (pound ...

Runtime Error LIne 297
I just set up a brand new Dell computer with Outlook 2003 as the mail program. Everytime the user opens the mailbox, she gets the following error: A Runtime Error has occurred. Do you wish to debug? Line 297 The debug opens, but I don't know what to do with it after that. Has anyone else worked through this? Any suggestions? ...

formula = ADD whatever is not highlighted.
Hi. I have a workbook which I use as my monthly budget. I have tried other software made for that, but this is really what I like. As transactions go through, I "highlight" the cell, using a variety of colors. I would like 1 cell (presumably, one that would calculate, what is left to go through) to add only the cells that are not highlighted, in a certain range. Any and all help is greatly appreciated. These should help. Sub addnoncolor() mysum = 0 For Each c In [m1:m5] If c.Interior.ColorIndex = 2 Then mysum = mysum + 1 Next MsgBox mysum End Sub Sub whatcolor() For Eac...