|
-
February 4th, 2004, 10:50 PM
#1
TreeControl bug?
My Dialog has a tree control and an edit control, in
a configuration window type setup.
The problem I am having is that when I click on another
item in the TreeControl, the KillFocus event for the edit
does not fire before the TreeControl events start up.
The order of messages seems to be:
TVN_ONCLICK
TVN_SELCHANGED
EN_KILLFOCUS
TVN_SETFOCUS
This seems strange...shouldn't the TreeControl have to gain focus
before it allows the user to perform any actions on it, like changing the selection?
-
February 5th, 2004, 12:09 AM
#2
Are you dealing with third party ActiveX control?
If yes you would have to turn to an third party ActiveX control’s documentation regarding events that control fires.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
February 5th, 2004, 02:13 AM
#3
Re: TreeControl bug?
Originally posted by Thresher
This seems strange...shouldn't the TreeControl have to gain focus
before it allows the user to perform any actions on it, like changing the selection?
No, not necessarily. The focus as such is only relevant for user interaction via the keyboard, so it is really up to the tree control whether it prefers to first process the selection change via the mouse and then send the notification message about the focus change. Also, note that we are not talking about the WM_KILLFOCUS and WM_SETFOCUS messages here, but about the notification messages EN_KILLFOCUS and TVN_SETFOCUS, which are sent back from the control to its parent window.
-
February 5th, 2004, 08:13 AM
#4
Re: Re: TreeControl bug?
Originally posted by gstercken
No, not necessarily. The focus as such is only relevant for user interaction via the keyboard, so it is really up to the tree control whether it prefers to first process the selection change via the mouse and then send the notification message about the focus change. Also, note that we are not talking about the WM_KILLFOCUS and WM_SETFOCUS messages here, but about the notification messages EN_KILLFOCUS and TVN_SETFOCUS, which are sent back from the control to its parent window.
So can you think of a work-around for this? Because the TreeControl TVN_ONCLICK is called before EN_KILLFOCUS for the Edit box I'm getting an undeseriable result by mixing different TreControl data with old EditBox data. Oh, and this is strictly MFC... no ActiveX or 3rd Party ActiveX here. THanks.
-
February 5th, 2004, 09:58 AM
#5
Re: Re: Re: TreeControl bug?
Originally posted by Thresher
So can you think of a work-around for this? Because the TreeControl TVN_ONCLICK is called before EN_KILLFOCUS for the Edit box I'm getting an undeseriable result by mixing different TreControl data with old EditBox data.
What do you mean by old EditBox data? The data in an edit control doesn't depend on the EN_KILLFOCUS message being sent or not. Just use appropriate DDX member variables for your controls. When the tree control is clicked, call UpdateData(TRUE) and access the corresponding member variable to get the contents of the edit control. Besides that, you should check if TVN_ONCLICK is actually the message you want to handle for your case. For example, what happens when the user switches to the tree control by pressing the tab key? What if he uses the arrow keys to navigate the tree control? I suspect that TVN_SELCHANGING or TVN_SELCHANGED are probably more suited - but it really depends on your actual needs.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|