First thanks to Iczelion for tut 31:) My question is how to remove focus from list view item after selected. I mean if message bos is displayed with file name like in tut then if I click ok then click again anywhere on listview window same message bos is displayed. Somehow it seems I must send message to remove focus from item after it displayed. Anybody know how to do this? best regards, czDrillard
Posted on 2001-06-09 12:24:00 by czDrillard
Sorry if I misunderstood you but I think it depends on where you click. If you first doubleclick on an item, click ok on the messagebox, and then doublclick on the text of another item, it displays the proper messagebox. However, if you don't click exactly on the text (but for example on the black space on the right of the text), you don't select the item so the old item is still selected. Thomas
Posted on 2001-06-09 17:19:00 by Thomas
Hi, maybe we both misunderstood the question but I think he uses some loop which checks periodically if the focus is on the listview which item is selected and then it gets the text into the messagebox. If this is the case (if not, just ignore it) you could just use a Flag which will be checked in the loop and only if active the first time the messagebox pops up. And in Order to know if the selection changed you could save the last item index number and compare it with the current one. If they are not equal you can set the Flag so that you see the messagebox once. Hehe, I am sure the gurus out there have much more professional ways to do it but this is the way I would go. Hmm, maybe I should add that I didn't take a look at tut 31 already. But after re-reading your post my feeling that my reply is rubbish gets stronger :( Stefan This message was edited by Stefan Krause, on 6/9/2001 6:27:04 PM
Posted on 2001-06-09 18:25:00 by Stefan Krause
Yes Thomas it is exactly right as you described it and that is what I try to change. Somehow remove seletion from last item so no message is displayed unless you click on an item. And like you say Stefan Icezlion use ShowCurrentFocus proc to display selected item in message box. Thanks for you flag suggestion and maybe I have to use it but I hoped for more elegant solution. Something like KillListViewFocus api :) best regards, czDrillard
Posted on 2001-06-09 21:45:00 by czDrillard
Maybe sending a LVM_SETITEMSTATE message to the control, removing the LVIS_FOCUSED item state from the selected item, solves the problem. Thomas
Posted on 2001-06-12 17:49:00 by Thomas
Hi Thomas, That sure seems like the right place to start. I checked, or thought I checked, all listview messages but somehow missed LVM_SETITEMSTATE. I work this over and see what I can do. I'll let you know and thanks for suggestion :) best regards, czDrillard
Posted on 2001-06-13 00:15:00 by czDrillard