Click here to Skip to main content
16,006,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Basic understanding question... Pin
valikac9-Jun-03 7:39
valikac9-Jun-03 7:39 
GeneralLayered window problem Pin
Bedas9-Jun-03 4:21
Bedas9-Jun-03 4:21 
GeneralRe: Layered window problem Pin
Ryan Binns9-Jun-03 4:37
Ryan Binns9-Jun-03 4:37 
GeneralRe: Layered window problem Pin
Bedas10-Jun-03 0:31
Bedas10-Jun-03 0:31 
GeneralRe: Layered window problem Pin
Ryan Binns10-Jun-03 0:51
Ryan Binns10-Jun-03 0:51 
GeneralList Control Pin
User 98859-Jun-03 3:49
User 98859-Jun-03 3:49 
GeneralRe: List Control Pin
valikac9-Jun-03 6:37
valikac9-Jun-03 6:37 
GeneralRe: List Control Pin
User 98859-Jun-03 6:56
User 98859-Jun-03 6:56 
I use

int index = GetNextItem(previous_index, LVNI_SELECTED);

to get the selected item.

With the OWNERDATA style, I don't have to insert items into the list view control using InsertItem. Rather, I just add items in the underlying container and call SetItemCount() on the control with the number of items.

Say, I was at index 0, and a new item was added at the top of the container. Now the selected index is still 0, but the item that is at that index is the new item. The same problem occurs when the container is sorted.

The only option I can think of now, is to get the object that is in the container at the index before changing it, and then find the index of same object in the modified container, and selecting that item from the code, and then make sure that the item is visible.

I was looking for an easier solution to this Big Grin | :-D




My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers


modified 29-Aug-18 21:01pm.

GeneralRe: List Control Pin
valikac9-Jun-03 7:26
valikac9-Jun-03 7:26 
GeneralGetting text into Word Pin
Martyn Pearson9-Jun-03 3:32
Martyn Pearson9-Jun-03 3:32 
GeneralRe: Getting text into Word Pin
Ryan Binns9-Jun-03 4:24
Ryan Binns9-Jun-03 4:24 
GeneralPrinting Pin
si_699-Jun-03 2:59
si_699-Jun-03 2:59 
GeneralRe: Printing Pin
Roger Allen10-Jun-03 0:45
Roger Allen10-Jun-03 0:45 
Generalwhere we used the static functions Pin
Rajesh match9-Jun-03 2:59
Rajesh match9-Jun-03 2:59 
GeneralRe: where we used the static functions Pin
David Crow9-Jun-03 5:42
David Crow9-Jun-03 5:42 
GeneralRe: where we used the static functions Pin
Rajesh match9-Jun-03 21:21
Rajesh match9-Jun-03 21:21 
GeneralRe: where we used the static functions Pin
David Crow10-Jun-03 2:11
David Crow10-Jun-03 2:11 
Generalwindow focusing problem in a multithreaded service application Pin
sreela9-Jun-03 2:16
sreela9-Jun-03 2:16 
GeneralUpdating menu check marks Pin
andyg.1019-Jun-03 1:47
andyg.1019-Jun-03 1:47 
GeneralRe: Updating menu check marks Pin
Ryan Binns9-Jun-03 4:29
Ryan Binns9-Jun-03 4:29 
QuestionHow to exchange variable with a Tab Control? Pin
Yohome9-Jun-03 1:38
Yohome9-Jun-03 1:38 
AnswerRe: How to exchange variable with a Tab Control? Pin
Joan M9-Jun-03 20:43
professionalJoan M9-Jun-03 20:43 
GeneralUsing ODBC with text files. Pin
vcseeker9-Jun-03 0:53
vcseeker9-Jun-03 0:53 
GeneralRe: Using ODBC with text files. Pin
basementman9-Jun-03 5:30
basementman9-Jun-03 5:30 
Generalmfc libraries download site Pin
3green8-Jun-03 23:01
3green8-Jun-03 23: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.