blinking cursor and scroll issue.

hello. here is my test code.

http://codepad.org/Ks4ZpOpj

[1] I see cursor blinking in every stcs on (OSX10.6.8, Python2.7,
wxPython2.9.13.1)

[2] below event not working on (Linux 11.10 32bit, wxPython2.9) but
it's working (Linux 11.10 32bit, wxPython2.8) and (OSX10.6.8,
Python2.7, wxPython2.9.13.1)

    def moveparentpanel(self, event):
        self.GetParent().GetEventHandler().ProcessEvent(event)
        event.Skip()

[3] below code is not working in order to move between stcs. because
there is a button.

    def OnKeyDown(self, event):
       if not (event.ControlDown() and event.GetKeyCode() ==
wx.WXK_TAB):
           event.Skip()
           return
       flag = wx.NavigationKeyEvent.IsForward
       if event.ShiftDown():
           flag = 0
       self.Navigate(flag)

so I am not sure how to move the cursor by arrow key.

    def OnKeyPressed(self, event):
        curStc = event.GetEventObject()
# print curStc.GetCurrentLine()
# privious = None
        if curStc.GetCurrentLine() == 0:
            allitems = [w.GetWindow() for w in
self.GetGrandParent().Autosizer.GetChildren() if w.GetWindow() is not
None]
# useNextone = False

            for item in allitems:
                if isinstance(item, wx.stc.StyledTextCtrl):
                    if curStc == item:
                        previous.SetFocus()
# useNextone = True
                        break
# elif useNextone == False:
# curStc.SetFocus()
                    else:
                        previous = item
# useNextone = False
        event.Skip()

Wonjun, Choi

testcode.py (7.55 KB)

hello. here is my test code.

http://codepad.org/Ks4ZpOpj

[1] I see cursor blinking in every stcs on (OSX10.6.8, Python2.7,
wxPython2.9.13.1)

wxOSX-cocoa is not sending the EVT_KILL_FOCUS events[1], so the STC does not get the signal to stop flashing the caret. As a workaround you could catch the focus event (EVT_SET_FOCUS) for all widgets and in the handler call the SetSTCFocus(False) method for all other STCs. That will do the same thing that the STC would do internally in its kill focus handler.

[1] wxTrac has been migrated to GitHub Issues - wxWidgets

[2] below event not working on (Linux 11.10 32bit, wxPython2.9) but
it's working (Linux 11.10 32bit, wxPython2.8) and (OSX10.6.8,
Python2.7, wxPython2.9.13.1)

     def moveparentpanel(self, event):
         self.GetParent().GetEventHandler().ProcessEvent(event)
         event.Skip()

The wheel events are probably being ignored if they were not sent to the window originally receiving them. You could try changing the event object so it looks like its intended target is the parent window, or make a new wheel event object for it. Or you could just call the parent's scrolling related functions yourself instead of (re)sending an event.

[3] below code is not working in order to move between stcs. because
there is a button.

As I said before if you don't want to do normal navigation then don't use the Navigate method and just call the target STC's SetFocus method to move the focus there.

···

On 3/26/12 6:47 PM, Wonjun, Choi wrote:

--
Robin Dunn
Software Craftsman

[1] I don’t know how can I to do that.

class TestPanel(wx.Panel):
def init(self, parent):

      self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)

  def OnSetFocus(self. event):
       currentSTC = event.GetEventObject()
       currentSTC.SetSTCFocus(True)
       self.Refresh()

[2] I am not sure, I hope you can show me an example.

    self.Bind(wx.EVT_MOUSEWHEEL, self.moveparentpanel)
    self.Bind(wx.EVT_SCROLLWIN, self.OnScroll1)
   
def moveparentpanel(self, event):
    self.GetParent().GetEventHandler().ProcessEvent(event)
    event.Skip()

def OnScroll1(self, event):
    clone = event.Clone()
    clone.SetId(self.GetParent().GetId())
    clone.SetEventObject(self.GetParent())
    self.GetEventHandler().ProcessEvent(clone)
    event.Skip()

[3] I am not sure, how can I do this. can you show me an example?

    self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)

def OnKeyPressed(self, event):
    curStc = event.GetEventObject()

print curStc.GetCurrentLine()

privious = None

    if curStc.GetCurrentLine() == 0:
        allitems = [w.GetWindow() for w in self.GetGrandParent().Autosizer.GetChildren() if w.GetWindow() is not None]

useNextone = False

        for item in allitems:
            if isinstance(item, wx.stc.StyledTextCtrl):
                if curStc == item:
                    previous.SetFocus()

useNextone = True

                    break

elif useNextone == False:

curStc.SetFocus()

                else:
                    previous = item

useNextone = False

    event.Skip()