about wx.TextCtrl

Hi, all:
     I have a question about wx.TextCtrl.
     I am not sure if any one has used a software called Mendeley
which is for article organization. And one feature of this software is
that in the detail tab, information like Author, years, journals are
showed like wx.StaticText. But when user want to change the
information, hover over the text, then the background color changed;
and then if click the text, it changes to like wx.TextCtrl.
     just want to ask is it possible to do this kind of effect in
wxpython?
     Thank you very much!

Hi,

test.py (971 Bytes)

···

On Tue, Dec 21, 2010 at 8:36 PM, zhengqing <zhengqinggan@gmail.com> wrote:

Hi, all:
I have a question about wx.TextCtrl.
I am not sure if any one has used a software called Mendeley
which is for article organization. And one feature of this software is
that in the detail tab, information like Author, years, journals are
showed like wx.StaticText. But when user want to change the
information, hover over the text, then the background color changed;
and then if click the text, it changes to like wx.TextCtrl.
just want to ask is it possible to do this kind of effect in
wxpython?

Yes its possible. (simple example attached)

You can bind to mouse motion events and update the screen how ever you
need to in response to the events.

see: wxPython API Documentation — wxPython Phoenix 4.2.2 documentation

Cody

Hi Cody,

Your example doesn’t work for me, I add some print statements at the top of OnEnter and OnLeave and when I tested it again, it didn’t print anything.

···


Hi, I will kill all ads in google gmail.

They will all be dead and gone for all my emails to you. HA HA bye bye ads I just massacred you!!!

Hi,

···

On Wed, Dec 22, 2010 at 8:31 AM, Micah Nordland <mpnordland@gmail.com> wrote:

Hi Cody,
Your example doesn't work for me, I add some print statements at the top of
OnEnter and OnLeave and when I tested it again, it didn't print anything.

Guessing your running on Linux?

The StaticText control is a little different on that platform as its
drawn on its parents background instead of its own window. Might need
to use motion events on the panel and track the mouse position
manually to know when its over one of the children windows.

Cody

Or use wx.lib.stattext.

···

On 12/22/10 6:54 AM, Cody Precord wrote:

Hi,

On Wed, Dec 22, 2010 at 8:31 AM, Micah Nordland<mpnordland@gmail.com> wrote:

Hi Cody,
Your example doesn't work for me, I add some print statements at the top of
OnEnter and OnLeave and when I tested it again, it didn't print anything.

Guessing your running on Linux?

The StaticText control is a little different on that platform as its
drawn on its parents background instead of its own window. Might need
to use motion events on the panel and track the mouse position
manually to know when its over one of the children windows.

--
Robin Dunn
Software Craftsman

Cody Precord wrote:

Your example doesn't work for me, I add some print statements at the top of
OnEnter and OnLeave and when I tested it again, it didn't print anything.

Guessing your running on Linux?

The StaticText control is a little different on that platform as its
drawn on its parents background instead of its own window. Might need
to use motion events on the panel and track the mouse position
manually to know when its over one of the children windows.

I'm pretty sure that there is a generic StaticText control in wx.lib somewhere that is a "real" wx.Windows, and thus supports this kind of thing on all platforms. It was created exactly for this reason.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Robin Dunn wrote:

Or use wx.lib.stattext.

beat me to it.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Time machine. :wink:

···

On 12/22/10 9:52 AM, Christopher Barker wrote:

Robin Dunn wrote:

Or use wx.lib.stattext.

beat me to it.

--
Robin Dunn
Software Craftsman