Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Treeview holding focus hostage!

This topic is 5418 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a ''main'' window with a treeview that holds items the user clicks on. When a double click is detected, a new window is opened up:
// WTL

ConversationWindow* newConvo = new ConversationWindow(e.contact);
The problem is I cannot get it to actually keep the focus on the window. What happens (when I use Spy++) is the window gets the focus and then the main window steals the focus back somehow. It seems like the Treeview needs the focus back to finish updating itself after it runs the handler. Here is my treeview WM_NOTIFY handler:
	LRESULT ContactListWindow::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&)
		NMHDR*	mhdr = reinterpret_cast<NMHDR*>(lParam);
		if(mhdr->code == NM_DBLCLK)
			Node* selectedNode = reinterpret_cast<Node*>(m_treeView.GetSelectedItem().GetData());
			if(selectedNode != 0)
		return CFrameWindowImpl<ContactListWindow>::DefWindowProc(uMsg, wParam, lParam);
This URL seems to be what my problem is but I tried implementing it by hooking the TVN_SELCHANGING message to no avail.

Share this post

Link to post
Share on other sites
Here''s what you do.

For whatever reason you can''t transfer the focus away from the Treeview in event handlers. Apparently this shows itself in the .NET framework as well. In Win32 at least, you have to post a user defined message to the parent window that you handle and take your double click action on.

Roundabout way of getting something to work but I''ve seen worse.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!