Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.wxwindows > #8
| Newsgroups | comp.soft-sys.wxwindows |
|---|---|
| From | Vadim Zeitlin <vadim@wxwidgets.org> |
| Subject | Re: Problems with losing focus on wxTextCtrl in wxGTK |
| References | <d989414a-8c1c-4561-afff-436479544792@t7g2000vbv.googlegroups.com> |
| Message-ID | <slrnj576np.2a1.vadim@sunset.tt-solutions.com> (permalink) |
| Date | 2011-08-23 12:20 +0000 |
| Organization | Guest of ProXad - France |
On 2011-08-21, Marco DeFreitas <defreitas@gmail.com> wrote:
> I also wanted to validate when the focus is lost on the (possibly bad)
> text field, for example the user might enter text in one field and
> then click on another text field.
>
> I was having problems changing focus within a focus event handler;
> that is, when focus is lost on a text field with bad data, I was
> having problems setting the focus back to the text field with bad
> data. However, I got things working reasonably well by just flagging
> the error in the "Kill Focus" event handler and then changing the
> focus in an "Idle" event handler that checked for the flagged error.
Hello Marco,
This is indeed the right thing to do as you can't always (i.e. on all
platforms) switch focus from focus event handler itself. Moreover, I
suspect -- although I didn't test this so I could be wrong -- that your
remaining problem is also due to "doing too much" from this event handler.
It should basically just set some internal flags and return, in particular
it shouldn't result in any focus changes itself and showing a message box
definitely does change focus.
So I think things should work better if you call wxMessageBox() from your
EVT_IDLE handler too. Alternatively, you could use wxLogError() (or maybe
wxLogWarning()) as they're shown during idle time and not immediately as
well.
Good luck,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Back to comp.soft-sys.wxwindows | Previous | Next — Previous in thread | Next in thread | Find similar
Problems with losing focus on wxTextCtrl in wxGTK Marco DeFreitas <defreitas@gmail.com> - 2011-08-21 13:31 -0700
Re: Problems with losing focus on wxTextCtrl in wxGTK Marco DeFreitas <defreitas@gmail.com> - 2011-08-21 13:38 -0700
Re: Problems with losing focus on wxTextCtrl in wxGTK Marco DeFreitas <defreitas@gmail.com> - 2011-08-21 13:52 -0700
Re: Problems with losing focus on wxTextCtrl in wxGTK Vadim Zeitlin <vadim@wxwidgets.org> - 2011-08-23 12:20 +0000
Re: Problems with losing focus on wxTextCtrl in wxGTK Marco DeFreitas <defreitas@gmail.com> - 2011-08-23 11:46 -0700
Re: Problems with losing focus on wxTextCtrl in wxGTK Marco DeFreitas <defreitas@gmail.com> - 2011-08-26 15:39 -0700
Re: Problems with losing focus on wxTextCtrl in wxGTK ericduba@gmail.com - 2012-06-12 12:23 -0700
csiph-web