wxStyledTextCtrl problem ?

P

Paul Robson

I have a wierd thing with a little editor app I'm writing.

I'm using wxStyledTextCtrl ; the wrapper for Scintilla. When I create the
frame in wxPython, I use self.Editor.SetFocus() to put the focus initially
on the editor.

This works fine.

Odd thing is though, switching back and forwards between applications
alternately hides and reappears the caret.

Hit Alt-Tab twice and it disappears
Hit Alt-Tab twice and it comes back.

It still works fine - there's just no caret. I've tried various things in
EVT_ACTIVATE including Moving the Caret on screen, and forcing it to be
visible - they are being called but it makes no difference.

Any ideas ?
 
J

Josiah Carlson

Paul Robson said:
I have a wierd thing with a little editor app I'm writing.

I'm using wxStyledTextCtrl ; the wrapper for Scintilla. When I create the
frame in wxPython, I use self.Editor.SetFocus() to put the focus initially
on the editor.

This works fine.

Odd thing is though, switching back and forwards between applications
alternately hides and reappears the caret.

Hit Alt-Tab twice and it disappears
Hit Alt-Tab twice and it comes back.

It still works fine - there's just no caret. I've tried various things in
EVT_ACTIVATE including Moving the Caret on screen, and forcing it to be
visible - they are being called but it makes no difference.

Any ideas ?

I don't know why the problem you are having happens, but I would just
make a call to self.Editor.SetFocus() on an EVT_ACTIVATE event.

- Josiah
 
J

Jean Brouwers

If you are running GTK+ try using

self.Editor.SetSTCFocus(True)

in addition to or instead of SetFocus(). Plus maybe

wx.CallAfter(self.Editor.EnsureCaretVisible)

It solved the 'dissapearing caret' problem for our application.


/Jean Brouwers
 
P

Paul Robson

I don't know why the problem you are having happens, but I would just
make a call to self.Editor.SetFocus() on an EVT_ACTIVATE event.

Tried that, it doesn't work :(

Or to be precise, it works every other time :)
 
P

Paul Robson

If you are running GTK+ try using

self.Editor.SetSTCFocus(True)

in addition to or instead of SetFocus(). Plus maybe

wx.CallAfter(self.Editor.EnsureCaretVisible)

It solved the 'dissapearing caret' problem for our application.

Thanks - that worked perfectly !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top