EDIT: Written originally by OpenPavillion, I made an error when transferring the post to the wxAUI forum from the Strata forum. Sorry about that. -- Ken
Hello,
I have a problem with a wxStyledTextCtrl inside AuiNotebook.
The program starts fine and i can enter data into the editors. But when clicking with the mouse onto the StyledTextCtrl, the TextCtrl seems to stall. When switching to another AuiNotebook, you can edit again. Until clicking with the mouse again.
What is the reason for this behaviour ?
Is there an uncaught mouse event handler in Aui or did I forget a handler ?
- Code: Select all
# -*- coding: cp1252 -*-
import wx
import wx.aui
from wx.lib.buttons import GenBitmapTextButton
import wx.stc as stc
class MyNotebookPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.parent = parent
self.notebook = wx.aui.AuiNotebook(self)
self.addPageXML()
self.addPageXML()
sizer = wx.BoxSizer()
sizer.Add(self.notebook, 1, wx.EXPAND)
self.SetSizer(sizer)
def addPageXML(self):
xml_panel = MyXMLPanel(self)
self.notebook.AddPage(xml_panel, "XML Editor")
class MyXMLEditor(stc.StyledTextCtrl):
def __init__(self, parent, ID,
pos=wx.DefaultPosition, size=wx.DefaultSize,
style=0):
stc.StyledTextCtrl.__init__(self, parent, ID, pos, size, style)
class MyXMLPanel(wx.Panel):
def __init__(self, parent, id=-1):
wx.Panel.__init__(self, parent, id, style=wx.NO_FULL_REPAINT_ON_RESIZE)
ed = MyXMLEditor(self, -1, size=(700, 500))
s = wx.BoxSizer(wx.HORIZONTAL)
s.Add(ed, 1, wx.EXPAND)
self.SetSizer(s)
self.SetAutoLayout(True)
ed.EmptyUndoBuffer()
ed.Colourise(0, -1)
ed.SetMarginType(1, stc.STC_MARGIN_NUMBER)
ed.SetMarginWidth(1, 25)
class MyAUIManager(wx.aui.AuiManager):
def __init__(self, parent):
wx.aui.AuiManager.__init__(self, parent)
self.AddPane(parent.notebookPanel, wx.CENTER, 'My Editor')
self.Update()
class MyFrame(wx.Frame):
startValue = 4711
def __init__(self, parent, id=-1, title='wx.aui Test', pos=(0,0), size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.__init__(self, parent, id, title, pos, size, style)
self.notebookPanel = MyNotebookPanel(self)
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.auiWindowsManager = MyAUIManager(self)
def OnClose(self, event):
self.auiWindowsManager.UnInit()
self.Destroy()
app = wx.App()
frame = MyFrame(None)
frame.Show()
app.MainLoop()
I am using Python 2.5 and wxpython 2.8.4.2 under Windows XP.
Regards
Pavilion