wxWidgets has wxStyledTextCtrl which (as I understand) uses Scintilla behind the scenes
I don't know much about Scintilla API, but I kinda have the idea that you issue commands to it.
In particular, I want to make the cursor have a block style, I found in Notepad++ the following snippet:
execute(SCI_SETCARETSTYLE, CARETSTYLE_BLOCK)
I want to do the same in the StyledTextCtrl, but I have no idea how to get to the scinitilla control behind the scene.
How do I do this?
P.S. I'm working in wxPython, but I suppose it doesn't make a difference.
Update:
After some digging in the c++ sources of wxWidgets, I found that most functions just call SendMsg
, for instance:
// Get the time in milliseconds that the caret is on and off. 0 = steady on.
void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds)
{
SendMsg(2076, periodMilliseconds, 0);
}
So I figured that this is how one would send commands to the underlying scintilla component.
So, I got the values I need
#define CARETSTYLE_INVISIBLE 0 #define CARETSTYLE_LINE 1 #define CARETSTYLE_BLOCK 2 #define SCI_SETCARETSTYLE 2512 #define SCI_GETCARETSTYLE 2513
So SCI_SETCARETSTYLE
is 2512, and block style is 2.
So I called SengMsg
with these parameters:
self.SendMsg(2512, 2)
But there didn't seem to be any effect!
What could be the reason? How can I debug this?