Re: TextCtrl EVT_SET_FOCUS on Windows loses cursor

Charley Khan <[email protected]>
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
Solved my own problem: posting here in case useful for others
A bit more research took me to this thread:
https://forums.wxwidgets.org/viewtopic.php?t=43215#p176477

which indicated the importance of calling Skip() on all focus event 
handlers.

This is indeed clearly documented:
https://wxpython.org/Phoenix/docs/html/wx.FocusEvent.html

> The focus event handlers should almost invariably call wx.Event.Skip on 
their event argument to allow the default handling to take place. 


-ck


On Saturday, June 27, 2020 at 1:44:24 AM UTC-7, Charley Khan wrote:
>
> wxpython 4.1.0, installed from pypi, Python 3.8
> On Windows (win7, and win 10) If I bind *anything* to TextCtrl 
> EVT_SET_FOCUS, I lose the insert cursor. 
> I can still type, but never see a cursor.
> On MacOS, multiple versions, it's fine: I always see the cursor.
>
> Is this an issue with native control, wxwidgets, or wxpython ?
> Thanks so much!
> -ck
>
> import wx
> print(wx.__version__)
> app = wx.App()
> frame = wx.Frame(None)
> t = wx.TextCtrl(frame)
>
>  
>
> # *** On Windows, next line will make textctrl cursor vanish.
> t.Bind(wx.EVT_SET_FOCUS, lambda x: None)
>
>  
>
> frame.Show()
> app.MainLoop()
>
>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/60449a47-1b8e-4300-8c13-7ffb9f506f8eo%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.