Click here to Skip to main content
15,891,409 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: make lowercase char to uppercase Pin
jmkhael7-May-03 4:33
jmkhael7-May-03 4:33 
GeneralRe: make lowercase char to uppercase Pin
Renjith Ramachandran7-May-03 4:34
Renjith Ramachandran7-May-03 4:34 
QuestionHow to delete entire row in CListCtrl? Pin
julych7-May-03 4:17
julych7-May-03 4:17 
AnswerRe: How to delete entire row in CListCtrl? Pin
Renjith Ramachandran7-May-03 4:21
Renjith Ramachandran7-May-03 4:21 
GeneralRe: How to delete entire row in CListCtrl? Pin
julych7-May-03 4:26
julych7-May-03 4:26 
GeneralRe: How to delete entire row in CListCtrl? Pin
jmkhael7-May-03 4:29
jmkhael7-May-03 4:29 
GeneralRe: How to delete entire row in CListCtrl? Pin
Hari Krishnan (Noida)7-May-03 5:20
Hari Krishnan (Noida)7-May-03 5:20 
AnswerRe: How to delete entire row in CListCtrl? Pin
G. Steudtel7-May-03 4:55
G. Steudtel7-May-03 4:55 
Hi,
if you need to find the selected item in a listcontrol, there is no function, to do it.

In your code for deleting a row you may use this to find the desired index

	<br />
  long lx;<br />
  LV_ITEM lvItem;<br />
  lvItem.iItem     = 0;<br />
  lvItem.iSubItem  = 0;<br />
  lvItem.mask      = 0;<br />
  lvItem.state     = 0;<br />
  lvItem.stateMask = 0;<br />
<br />
  if(m_VarForListCtrl.GetSelectedCount() != 1 ) return;<br />
  // if none or more than one are selected bail out<br />
<br />
  int  iItem = m_VarForListCtrl.GetTopIndex();<br />
  int  iMax  = m_VarForListCtrl.GetCountPerPage();<br />
  for( int i = iItem; i < ( iItem + iMax ); i++)<br />
     { lvItem.iItem     =  i;<br />
       lvItem.iSubItem  =  0;<br />
       lvItem.mask      = LVIF_STATE;<br />
       lvItem.state     = LVIS_SELECTED;<br />
       lvItem.stateMask = LVIS_SELECTED;<br />
       if( !m_VarForListCtrl.GetItem(&lvItem) )<br />
         { return; // if item can't be read, do nothing<br />
         }<br />
       if( lvItem.state ) break;// found item<br />
     }<br />
  if( !lvItem.state ) return; // no item found<br />
  // lvItem.iItem now has the index of the selected row<br />
  m_VarForListCtrl.DeleteItem(lvItem.iItem);<br />


This code wil find only the selected item if it's visible.
You must adapt the code, if you are searching the whole list.

Was it this you were looking for?

G. Steudtel
QuestionHow to select the entire row in CListControl Pin
julych7-May-03 4:13
julych7-May-03 4:13 
AnswerRe: How to select the entire row in CListControl Pin
Dr-Kuulun7-May-03 4:17
Dr-Kuulun7-May-03 4:17 
AnswerRe: How to select the entire row in CListControl Pin
JensB7-May-03 4:18
JensB7-May-03 4:18 
AnswerRe: How to select the entire row in CListControl Pin
Muhammad Ahmed7-May-03 4:18
Muhammad Ahmed7-May-03 4:18 
AnswerRe: How to select the entire row in CListControl Pin
Renjith Ramachandran7-May-03 4:19
Renjith Ramachandran7-May-03 4:19 
GeneralLoading Icon in a Property Sheet Button Pin
Muhammad Ahmed7-May-03 4:06
Muhammad Ahmed7-May-03 4:06 
GeneralRe: Loading Icon in a Property Sheet Button Pin
Renjith Ramachandran7-May-03 4:14
Renjith Ramachandran7-May-03 4:14 
GeneralRe: Loading Icon in a Property Sheet Button Pin
Muhammad Ahmed7-May-03 4:23
Muhammad Ahmed7-May-03 4:23 
QuestionHow do I hide the second apps Main Window?? Pin
IrishSonic7-May-03 4:05
IrishSonic7-May-03 4:05 
AnswerRe: How do I hide the second apps Main Window?? Pin
jmkhael7-May-03 4:28
jmkhael7-May-03 4:28 
AnswerRe: How do I hide the second apps Main Window?? Pin
Renjith Ramachandran7-May-03 4:30
Renjith Ramachandran7-May-03 4:30 
GeneralRe: How do I hide the second apps Main Window?? Pin
IrishSonic7-May-03 5:22
IrishSonic7-May-03 5:22 
GeneralRe: How do I hide the second apps Main Window?? Pin
jhwurmbach7-May-03 5:40
jhwurmbach7-May-03 5:40 
GeneralAntialias TextOut Pin
Kyudos7-May-03 3:08
Kyudos7-May-03 3:08 
GeneralRe: Antialias TextOut Pin
ZoogieZork7-May-03 3:18
ZoogieZork7-May-03 3:18 
GeneralRe: Antialias TextOut Pin
Kyudos7-May-03 3:23
Kyudos7-May-03 3:23 
GeneralText import wizard Pin
yaname7-May-03 3:01
yaname7-May-03 3:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.