Leaving controls

  • Thread starter Thread starter Daniel Faensen
  • Start date Start date
D

Daniel Faensen

To edit labels in a GDI image I have placed a TextBox programmatically
in a Panel. In the TextBox.Leave event I read the Text property,
assing its value to my business object and close the TextBox. The
problem is that when I click the mouse outside the TextBox the Leave
event is not fired. The only way I get it fired is by hitting the Tab
key.

Of course I could catch the mouse click event in the Panel and handle
closing of the TextBox there but that would actually not help since
clicking other controls in my form should also leave the TextBox.
What do you suggest to work around this problem?

Thank you in advance

Daniel Faensen
 
* (e-mail address removed)-berlin.de (Daniel Faensen) scripsit:
To edit labels in a GDI image I have placed a TextBox programmatically
in a Panel. In the TextBox.Leave event I read the Text property,
assing its value to my business object and close the TextBox. The
problem is that when I click the mouse outside the TextBox the Leave
event is not fired. The only way I get it fired is by hitting the Tab
key.

Of course I could catch the mouse click event in the Panel and handle
closing of the TextBox there but that would actually not help since
clicking other controls in my form should also leave the TextBox.
What do you suggest to work around this problem?

Clicking the panel won't cause the textbox to loose the focus. Does the
event fire if the focus is set to an other control? Maybe you should
handle the control's 'LostFocus' event instead of 'Leave'.
 
Back
Top