Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

List view delayed response

michael_green
Beginner
1,057 Views
Hi,
I'm using the following code to select a row from a list view:
case(WM_NOTIFY)
if(uParam==IDC_selection)then
pListView = lparam
if(pLvdi%hdr%code==LVN_ITEMACTIVATE)then
iret = SendMessage(hWndList,LVM_GETNEXTITEM, &
-1,MAKELPARAM(LVNI_SELECTED,0))
vectitem = iret + 1
bret = EnableWindow(GetDlgItem(hDlg,IDC_display),.TRUE.)
bret = EnableWindow(GetDlgItem(hDlg,IDC_remove),.TRUE.)
end if
end if
It works. But why is there a noticeable delay (about 1/3 second) between selection of a row and the enabling of the two buttons IDC_display & IDC_remove? Is there anything I can do about this? I'd like it to be "instantaneous".
With many thanks in advance,
Mike
0 Kudos
4 Replies
Jugoslav_Dujic
Valued Contributor II
1,057 Views
What happens if you remove call to LVM_GETNEXTITEM?
If I read the documents correctly, there's no need to call LVM_GETNEXTITEM at all. The information on selected item is supposed to be supplied in NMITEMACTIVATE.iItem and uNewState/uChagned, and I assume that pLvdi is actually a T_NMITEMACTIVATE.
I agree that MSDN states that "and then send the LVM_GETNEXTITEM message with LVNI_SELECTED until all of the items have been retrieved. ", but that makes sense if either 1) it is a multiple-selection list view or 2) you're supporting systems older than IE 4.0 (the age of dinosaurs), when lParam did not pointed to a T_NMITEMACTIVATE.
Juoglsav
0 Kudos
michael_green
Beginner
1,057 Views
Hi Jugoslav,
If I remove the check on LVN_ITEMACTIVATE the two buttons are enabled as soon as the mouse cursor enters any part of the list box.
I stole the original code from an example somewhere without really understanding it. The declarations were:
type (T_LVITEM)item
type (T_NMLVDISPINFO) pLvdi
pointer (plistview,pLvdi)
I have since changed T_NMLVDISPINFO to T_NMITEMACTIVATE and it made no difference at all - I still get the delayed response, although apart from the delay, everything works correctly.
Thanks again for your help
Mike
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,057 Views
OK, it seems we're both a bit confused by this history of ListView talk...
I've read few more pieces of information and I'll try to make it straight (but take the following with grain of salt, it's my interpretation rather than something I've gone through):
LVN_ITEMACTIVATEmeansthat theuser really "starts" an item, i.e. when it double-clicks it or hits Enter on the keyboard while it's selected... normally. LVS_EX_ONECLICKACTIVATE activate changes that behaviour to a single-click. LVN_ITEMACTIVATE has a pointer to T_NMLVACTIVATE as lParam.
On the other hand, LVN_ITEMCHANGED means that user merely (de)selected an item by single-clicking itor using Shift on the keyboard. It's lParam points to T_NMLISTVIEW. I guess that this is the message you're looking for. LVS_EX_TRACKSELECT, as well as LVS_EX_ONECLICKACTIVATE and LVS_EX_TWOCLICKACTIVATE affect the behaviour by enabling "hot-tracking".
Note that e.g. standard Windows Explore ListView does not have any of above-mentioned LVS_EX_ stylesin default setting (Thank God, the Explorer as well as most of MS Software has a long history of Stupid Defaults ).
Further, T_NMLVACTIVATE and T_NMLISTVIEW appear to be the same thing (as I see, they have identical members but only different names) so you can use one or another.
Jugoslav
0 Kudos
michael_green
Beginner
1,057 Views
Thanks Jugoslav, all problems resolved.
Mike
0 Kudos
Reply