Hi, MASMers,
DUMB QUESTION. I have an application that functions correctly. It has a List View, which displays a whole bunch of information.
This application is an MDI application,...not only does it display a List View, but it also displays a number of child windows that provide information.
There is just one minor problem: I have written code so that when the user double-clicks on an item (in the List View), a child window pops up with more information. The index of the selected item is saved to a structure data variable.
What I'm trying to do is highlight the previously selected item when the child window is closed. Sounds simple, doesn't it ???
Here is the relevant code:
mov ecx, dwCountLVItems ; dwCountLVItems is the count of List View items returned previously.
SUB ecx, 1
invoke SendMessage, hListView, LVM_REDRAWITEMS, 0, ecx
invoke RtlZeroMemory, ADDR SetSelectdItem, SIZEOF LV_ITEMA
mov SetSelectdItem.imask, LVIF_STATE ;
mov ecx, AppZenState.SelectedItem ; The Item index saved from the List View, LVN_ITEMACTIVATE message handler (WM_NOTIFY).
mov SetSelectdItem.iItem, ecx ; Zero-based index of the item to which this structure refers.
mov SetSelectdItem.iSubItem, 0 ; Zero if this structure refers to an item rather than a subitem.
mov SetSelectdItem.state, LVIS_SELECTED OR LVIS_FOCUSED ; If these bits are zero, the item has no overlay image.
mov SetSelectdItem.stateMask, -1 ; Value specifying which bits of the state member will be retrieved or modified.
mov SetSelectdItem.pszText, 0 ; pszText is a pointer to a valid buffer that will contain the item text.
mov SetSelectdItem.lParam, 0 ; Value specific to the item.
invoke SendMessage, hListView, LVM_SETITEMSTATE, 0, ADDR SetSelectdItem ;
This code doesn't work (nothing happens when the child window is closed, except that the List View is re-painted). Got any brilliant ideas ???
(...And,...yes, AppZenState.SelectedItem actually contains an index number (it's a structure containing saved data),...I print this out to a text file as a check, when the user double-clicks an item.)
Try invoke SetFocus, hList.
Thanks, JOCHEN,
Quote from: JOCHENTry invoke SetFocus, hList.
Yeah,...that's all it took. Everything works perfectly now. :bgrin: