Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with ListView.Visible and focus 1

Status
Not open for further replies.

graabein

Programmer
Oct 9, 2002
186
NO
Hi, I have a rather complex application that has a main ListView that gets refreshed from the database on a timer.

When data has changed I hide the ListView while I rebuild it. Problem occurs when another app has focus and the ListView is updated on my app, and the ListView in my app is the active control. Then my app jumps to the front and grabs focus!!

How can I change active control/focus from the ListView to another control before and after I rebuild it, without stealing focus from other apps on the machine?

[elephant2]
graabein
 
For now I've changed the rebuilding routine and instead of setting ListView.Visible = False and True I just put a ListView.Refresh at the end. I get some weird behaviour with the selected highlight jumping up and down though.

[elephant2]
graabein
 
If that's a real problem (the selected behaviour) you could have a look into (and yes, this is probably overkill [wink]) SendMessage() API in conjunction with WM_SETREDRAW.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
I think I'll try remembering the previous selected row, do a HideSelection and SelectedItem = Nothing, then reset the selected row while rebuilding (or after) and do HideSelection = False when I'm done.

If that don't work and the selected row jumping still bothers me I'll try your tip [peace]

[elephant2]
graabein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top