[wxPython] Arrow keys stop working

# Use the tool bar to open the wxFileDialog
# cancel out of it and try to use the arrow keys.
# they don't work
# Sorry if this is old hat. I couldn't find any mention of it in this list.

···

#
# Darrell Gallion

from wxPython.wx import *
from wxPython.stc import *

class PythonSTC(wxStyledTextCtrl):
    def __init__(self, parent, ID, topWindow):
        wxStyledTextCtrl.__init__(self, parent, ID)

    def OnOpenFile(self, evt):
        dlg = wxFileDialog(self, "Choose a file", ".", "", "*.*", wxOPEN)
        if dlg.ShowModal() == wxID_OK:
            self.SetText(open(dlg.GetPath()).read())
        dlg.Destroy()

    def BuildToolBar(self, toolBar, frame):
        toolBar.AddSimpleTool(20, wxBitmap('open.bmp', wxBITMAP_TYPE_BMP),
"Open")
        EVT_TOOL(frame, 20, self.OnOpenFile)
        toolBar.Realize()

def create(frame, topWindow, log):
    ed = PythonSTC(frame, -1, topWindow)
    toolBar =frame.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER)
    ed.BuildToolBar(toolBar, frame)
    ed.SetText("now is the time \n")
    return ed

if __name__ == '__main__':
    import sys
    app = wxPySimpleApp()
    frame = wxFrame(None, -1, "Tester...")
    win = create(frame, frame, sys.stdout)
    frame.Show(true)
    app.MainLoop()

Great !!!
It works at home on my Win2k system.
Not at work on NT4 ??

I'll reinstall wxPython tomorrow I guess ???
Also I think I'm using stackless at work.
Python 1.52 at both locations.

# Use the tool bar to open the wxFileDialog
# cancel out of it and try to use the arrow keys.
# they don't work
# Sorry if this is old hat. I couldn't find any mention of it in this

list.

···

From: "Darrell Gallion" <darrell@dorb.com>

#
# Darrell Gallion

Darrell Gallion wrote:

Great !!!
It works at home on my Win2k system.
Not at work on NT4 ??

I also have this problem on NT4, reinstalling does not help.

No fixes as far as I know.

···

--
Riaan >>> a='a=%s;a%%`a`';a%`a`
___________________________________________________
Boa Constructor - RAD GUI building IDE for wxPython
     http://boa-constructor.sourceforge.net

# Use the tool bar to open the wxFileDialog
# cancel out of it and try to use the arrow keys.
# they don't work

    I think this will just be a focus issue with the keyboard focus left on
the toolbar. You could try an explicit focus set at the end of OnOpenFile.
Sorry, I don't know how to write this in wx.

   Neil

    I think this will just be a focus issue with the keyboard focus left

on

the toolbar. You could try an explicit focus set at the end of OnOpenFile.
Sorry, I don't know how to write this in wx.

Thanks, I'll try it tomorrow.

  def OnOpenFile(self, evt):
        dlg = wxFileDialog(self, "Choose a file", ".", "", "*.*", wxOPEN)
        if dlg.ShowModal() == wxID_OK:
            self.SetText(open(dlg.GetPath()).read())
        dlg.Destroy()
        self.SetFocus()

--Darrell Gallion

···

From: "Neil Hodgson" <neilh@scintilla.org>

Hi Neil,

Neil Hodgson wrote:

> # Use the tool bar to open the wxFileDialog
> # cancel out of it and try to use the arrow keys.
> # they don't work

    I think this will just be a focus issue with the keyboard focus left on
the toolbar. You could try an explicit focus set at the end of OnOpenFile.
Sorry, I don't know how to write this in wx.

As far as I can tell it's not a simple focus issue. The problem even
occurs if you open and close a file dialog before creating a
wxStyledTextCtrl.

···

--
Riaan >>> a='a=%s;a%%`a`';a%`a`
___________________________________________________
Boa Constructor - RAD GUI building IDE for wxPython
     http://boa-constructor.sourceforge.net