Kirix Support Forums

wxStyledTextCtrl in AuiNotebook stalls when clicking TextCtr

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

wxStyledTextCtrl in AuiNotebook stalls when clicking TextCtr

Postby Ken on Tue Sep 11, 2007 8:19 am


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
Ken Kaczmarek
Kirix Support Team
User avatar
Ken
Kirix Support Team
 
Posts: 147
Joined: Mon Dec 19, 2005 10:36 am

Re: wxStyledTextCtrl in AuiNotebook stalls when clicking TextCtr

Postby Ben on Tue Sep 11, 2007 8:22 am

Hi there,

As far as I know, wxAUI doesn't intercept any events from a child window. It does however, handle child focus events, which indicate that a child was focussed. Still, I cannot see how this could cause the problem. I use wxSTC myself with wxAUI with no problems. I don't know if it could be related to any python wrapper aspects, but that is one difference I see.

Have you tried out your text control without using wxAUI, and the problem doesn't happen?

Best,
Ben
Ben Williams
Kirix Support Team
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Re: wxStyledTextCtrl in AuiNotebook stalls when clicking TextCtr

Postby OpenPavilion on Tue Sep 11, 2007 2:06 pm

Hello Ben,
Hello Ken,

thank you for jumping in so fast. You are right. It is no Aui topic, it isn't even a wxpython topic at all.

I simply mounted the notebook pages to the frame - not to the notebook as I should have.
So it was a typical coder error. Sorry for interrupting you.

Thanks again for your fast suport and please keep up with that amazing aui work !!

Regards
Pavilion

[...]
class MyNotebookPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
[...]
def addPageXML(self):
xml_panel = MyXMLPanel(self.notebook)
self.notebook.AddPage(xml_panel, "XML Editor")
[...]
OpenPavilion
Registered User
 
Posts: 7
Joined: Thu Aug 02, 2007 2:26 pm

Re: wxStyledTextCtrl in AuiNotebook stalls when clicking TextCtr

Postby Ken on Tue Sep 11, 2007 2:26 pm

Always happy to help!
Ken Kaczmarek
Kirix Support Team
User avatar
Ken
Kirix Support Team
 
Posts: 147
Joined: Mon Dec 19, 2005 10:36 am

Return to wxAUI Questions, Thoughts & Feedback