Event when a TextCtrl has focus?

I've been looking through the events and I can't seem to find the one
that I want. I've got several TextCtrl's in my program and I would
like to know when a user clicks in the text control, in preparation
for entering text. Basically, when the control has focus and a
blinking cursor. Does such an event exist? How about its converse --
an event for when the control loses focus?

Thanks,

Isaac

You can bind to the control's wx.EVT_SET_FOCUS and wx.EVT_KILL_FOCUS events.

Or, if you were using Dabo, just add an onGotFocus() and/or an
onLostFocus() method. Much simpler and more direct.

···

On 2/19/07, Isaac Wagner <geekyisaac@gmail.com> wrote:

I've been looking through the events and I can't seem to find the one
that I want. I've got several TextCtrl's in my program and I would
like to know when a user clicks in the text control, in preparation
for entering text. Basically, when the control has focus and a
blinking cursor. Does such an event exist? How about its converse --
an event for when the control loses focus?

--

# p.d.

Ah, thanks. Those were exactly the events I needed.

I'll look into Dabo. I'm not familiar with it.

···

On 2/19/07, Peter Decker <pydecker@gmail.com> wrote:

On 2/19/07, Isaac Wagner <geekyisaac@gmail.com> wrote:

> I've been looking through the events and I can't seem to find the one
> that I want. I've got several TextCtrl's in my program and I would
> like to know when a user clicks in the text control, in preparation
> for entering text. Basically, when the control has focus and a
> blinking cursor. Does such an event exist? How about its converse --
> an event for when the control loses focus?

You can bind to the control's wx.EVT_SET_FOCUS and wx.EVT_KILL_FOCUS events.

Or, if you were using Dabo, just add an onGotFocus() and/or an
onLostFocus() method. Much simpler and more direct.

--

# p.d.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

http://dabodev.com

I used raw wxPython for a while, but switched to the dabo.ui stuff
about a year ago. It gives you all the quality of wxPython, but with a
more elegant and Pythonic way of working.

···

On 2/19/07, Isaac Wagner <geekyisaac@gmail.com> wrote:

Ah, thanks. Those were exactly the events I needed.

I'll look into Dabo. I'm not familiar with it.

--

# p.d.

Just for the record, whether events or virtual functions are "better"
or "more pythonic" is pretty much open to debate. Dabo has a lot of
excellent features but I'm not convinced that auto-mapping events to
specially named functions is one of them.

···

On 2/19/07, Peter Decker <pydecker@gmail.com> wrote:

On 2/19/07, Isaac Wagner <geekyisaac@gmail.com> wrote:

> Ah, thanks. Those were exactly the events I needed.
>
> I'll look into Dabo. I'm not familiar with it.

http://dabodev.com

I used raw wxPython for a while, but switched to the dabo.ui stuff
about a year ago. It gives you all the quality of wxPython, but with a
more elegant and Pythonic way of working.
--

Then you simply set dabo.autoBindEvents = False in your startup.

Isn't it great to have a choice?

···

On 2/20/07, Chris Mellon <arkanes@gmail.com> wrote:

Just for the record, whether events or virtual functions are "better"
or "more pythonic" is pretty much open to debate. Dabo has a lot of
excellent features but I'm not convinced that auto-mapping events to
specially named functions is one of them.

--

# p.d.

To be clear: I think that Dabo evangelism in areas where Dabo has a
clear, obvious advantage over wxPython, and the poster has expressed
an interest in looking for a solution is warranted and reasonable.
Replying to any post where Dabo does something different that wxPython
with the implication that it is superior is obnoxious. It's exactly
like the language trolls you sometimes encounter on c.l.p or c.l.c++,
who will answer any question by telling you that you should use Java
or o'caml or whatever instead.

So when someone says they're looking for a suite of data bound
controls for wxPython, I have no trouble with someone suggesting they
look at Dabo, and I've done so myself. If someone says they're sick of
binding events and calling setters and want virtual functions and
properties for everything, suggesting Dabo is totally reasonable.

When someone asks a specific question about how to do something,
especially on this list, telling them how to do it in Dabo becomes
intrusive.

···

On 2/20/07, Peter Decker <pydecker@gmail.com> wrote:

On 2/20/07, Chris Mellon <arkanes@gmail.com> wrote:

> Just for the record, whether events or virtual functions are "better"
> or "more pythonic" is pretty much open to debate. Dabo has a lot of
> excellent features but I'm not convinced that auto-mapping events to
> specially named functions is one of them.

Then you simply set dabo.autoBindEvents = False in your startup.

Isn't it great to have a choice?

When someone asks a specific question about how to do something,
especially on this list, telling them how to do it in Dabo becomes
intrusive.

As a reader and occasional poster on this list, I have to say I don't mind it at all. If he had just replied with the solution in dabo, I agree that that is obviously unhelpful and annoying; however, he answered the question first and then just added that dabo does it a different way. To me this extra information is neat to learn about and if someone isn't interested they can stop reading after "if you were using dabo...".

Just my '$%.2f'%.02 :]

Chris Mellon ha scritto:

To be clear: I think that Dabo evangelism in areas where Dabo has a
clear, obvious advantage over wxPython, and the poster has expressed
an interest in looking for a solution is warranted and reasonable.
Replying to any post where Dabo does something different that wxPython
with the implication that it is superior is obnoxious. It's exactly
like the language trolls you sometimes encounter on c.l.p or c.l.c++,
who will answer any question by telling you that you should use Java
or o'caml or whatever instead.

So when someone says they're looking for a suite of data bound
controls for wxPython, I have no trouble with someone suggesting they
look at Dabo, and I've done so myself. If someone says they're sick of
binding events and calling setters and want virtual functions and
properties for everything, suggesting Dabo is totally reasonable.

When someone asks a specific question about how to do something,
especially on this list, telling them how to do it in Dabo becomes
intrusive.

Well, the example with language trolls you did is not that matching.
c++, python, ocaml are (at very first approximation) mutually exclusive
alternatives. Dabo is, AFAIK, something built on wxPython itself.

The poster was just gently suggesting that the Dabo toolkit allowed it
to work in another way, that maybe the OP could have liked better. Yes,
it's "gentle spamming", but of the useful kind, and stays on topic. I've
never used Dabo, but I like to know what's in the swiss army knife, so
this kind of posts looks interesting to me.

m.