Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVT_CHAR handler not called for TE_MULTILINE TextCtrl on macOS #804

Open
ExplodingCabbage opened this issue Mar 29, 2018 · 1 comment
Open
Labels
4.1.x things that cannot be done in 4.0.x wxWidgets

Comments

@ExplodingCabbage
Copy link
Contributor

ExplodingCabbage commented Mar 29, 2018

Operating system: macOS
wxPython version: 4.0.1
Stock or custom build: Stock
Python version: 3.6.1
Stock or custom build: Stock

Description of the problem: EVT_CHAR handlers on a TextCtrl are not called if the TextCtrl has the TE_MULTILINE Window Style flag set.

This has previously been noted by Hesky Fisher at https://stackoverflow.com/q/31620085/1709587, and I experienced the same thing today.

Demo: try running the program below on a Mac, and observe that "Change handler 1 called" is printed if you type in the first TextCtrl, but nothing is printed if you type in the second TextCtrl.

import wx

app = wx.App()
frame = wx.Frame(None, title="Test App", size=(640, 480))

panel = wx.Panel(frame)

text_ctrl_1 = wx.TextCtrl(panel, pos=(0, 0), size=(200, 25))
text_ctrl_2 = wx.TextCtrl(panel, pos=(0, 100), size=(200, 100),
                          style=wx.TE_MULTILINE)

def change_handler_1(event):
    print("Change handler 1 called")
    event.Skip()

def change_handler_2(event):
    print("Change handler 2 called")
    event.Skip()

text_ctrl_1.Bind(wx.EVT_CHAR, change_handler_1)
text_ctrl_2.Bind(wx.EVT_CHAR, change_handler_2)

frame.Show()
app.MainLoop()
@wxWidgets wxWidgets deleted a comment from mesalu Mar 30, 2018
@RobinD42
Copy link
Member

RobinD42 commented Apr 1, 2018

This is an issue in wxWidgets 3.0, which appears to have already been fixed in 3.1. wxPython will get the fix in version 4.1, which is being worked on now.

It would be nice to get the fix in wxWidgets 3.0 too, and filing an issue in their Trac may get some traction. But if the fix required a change that was not ABI compatible then it may not be possible.

@mesalu mesalu added the 4.1.x things that cannot be done in 4.0.x label Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.1.x things that cannot be done in 4.0.x wxWidgets
Projects
None yet
Development

No branches or pull requests

3 participants