PyFrame Guide to wxPython
Copyright and License information Home
__ A B C D E F G H I L M P R S T U V W
wxStyledTextCtrl - wxStyledTextEvent
__init__
Clone
GetAlt
GetControl
GetDragAllowMove
GetDragResult
GetDragText
GetFoldLevelNow
GetFoldLevelPrev
GetKey
GetLength
GetLine
GetLinesAdded
GetListType
GetLParam
GetMargin
GetMessage
GetModificationType
GetModifiers
GetPosition
GetShift
GetText
GetWParam
GetX
GetY
SetDragAllowMove
SetDragResult
SetDragText
SetFoldLevelNow
SetFoldLevelPrev
SetKey
SetLength
SetLine
SetLinesAdded
SetListType
SetLParam
SetMargin
SetMessage
SetModificationType
SetModifiers
SetPosition
SetText
SetWParam
SetX
SetY
Summary:
The wxStyledTextEvent is the interface between Scintilla notifications and your Python program. wxStyledTextEvent inherits from wxCommandEvent and inherits familiar methods from that class; but many of them (e.g., IsChecked()), don't make any sense for the STC. However, wxCommandEvent inherits from wxEvent; methods from the wxEvent class can be useful (e.g., GetId() and Skip()).
There are two basic types of events that will be sent to a wxPython application, EVT_STC_CHANGE and all the others. The former is sent to your application when the Scintilla event NotifyChange occurs. This one occurs whenever a change is made to the text of the document, but not for changes in styling information. This event is simple: there's no significant information in the event object other than the fact that it occurred and the ID of the STC.
The other events are sent to your app when the internal Scintilla event NotifyParent occurs. Many of these events have little information aside from the event type and the STC id. Some others have information about position, keypress, modifiers (alt, shift, ctrl). Others have information about text content, folding, etc. You need to examine the event itself to see what's provided: See this page and Events for specifics.
You can control what types of modifications will fire a EVT_STC_CHANGE and EVT_STC_MODIFIED event with the SetModEventMask command. Important! No modifications may be performed while servicing these two events!!
wxStyledTextEvent attributes:
These are the attributes specific to this event (not including any due to inheritance). The names of the C-language variables are shown. There's no direct access to these variables, you need to use the methods shown on this page to access them.
int m_position;
int m_key;
int m_modifiers;
int m_modificationType;
wxString m_text;
int m_length;
int m_linesAdded;
int m_line;
int m_foldLevelNow;
int m_foldLevelPrev;
int m_margin;
int m_message;
int m_wParam;
int m_lParam;
int m_listType;
int m_x;
int m_y;
wxString m_dragText;
bool m_dragAllowMove;
wxDragResult m_dragResult;
Note that wxPython handles conversions to and from wxWindows-specific types such as wxString.
----
The values for m_modificationType are shown below. These can be used in your Python program.
wxSTC_MOD_INSERTTEXT
wxSTC_MOD_DELETETEXT
wxSTC_MOD_CHANGESTYLE
wxSTC_MOD_CHANGEFOLD
wxSTC_PERFORMED_USER
wxSTC_PERFORMED_UNDO
wxSTC_PERFORMED_REDO
wxSTC_LASTSTEPINUNDOREDO
wxSTC_MOD_CHANGEMARKER
wxSTC_MOD_BEFOREINSERT
wxSTC_MOD_BEFOREDELETE
wxSTC_MODEVENTMASKALL
----
__init__(commandType,id)
Create a new event object. CommandType is the type of event, such as wxEVT_STC_CHANGE, wxEVT_STC_STYLENEEDED, etc. id is the control id. Note that a user should not ordinarily need to create an event. Most of the Set methods are not used by user code, with the exception of perhaps SetDragResult or SetDragAllowMove.
top
----
Clone
Create a copy of the event. Required by wxWindows event system.
top
----
GetAlt
Returns the state of the ALT bit in the m_modifiers attribute; i.e., is 1 if the ALT key was pressed for this event. Valid for EVT_STC_MARGINCLICK and EVT_STC_KEY (EVT_STC_KEY not sent in win32).
top
----
GetControl
Returns the state of the CTRL bit in the m_modifiers attribute; i.e., is 1 if the CTRL key was pressed for this event. Valid for EVT_STC_MARGINCLICK and EVT_STC_KEY (EVT_STC_KEY not sent in win32).
top
----
GetDragAllowMove
Get the value of the m_dragAllowMove. Always initially set TRUE for the EVT_STC_START_DRAG event. See SetDragAllowMove for more information.
top
----
GetDragResult
Get the value of m_dragResult. See SetDragResult.
top
----
GetDragText
Get the value of m_dragText. This is a string that contains text to be dropped into the STC.
top
----
GetFoldLevelNow
Get the value of m_foldLevelNow. The fold level after to a change in folding level. See also GetFoldLevelPrev.
top
----
GetFoldLevelPrev
Get the value of m_foldLevelPrev. The fold level prior to a change in folding level. GetModificationType will be wxSTC_MOD_CHANGEFOLD | wxSTC_MOD_CHANGEMARKER. Sent in response to a change in fold level sent from a client using SetFoldLevel or due to a change in fold level performed by a lexer that supports folding (if applicable).
top
----
GetKey
Returns the value of m_key. This is valid for EVT_STC_CHARADDED and EVT_STC_KEY (ECT_STC_KEY not used in win32).
top
----
GetLength
Returns the value of m_length. This is valid for EVT_STC_NEEDSHOWN and EVT_STC_MODIFIED.
top
----
GetLine
Returns the value of m_line. Valid for EVT_STC_MODIFIED. GetModificationType will be wxSTC_MOD_CHANGEFOLD | wxSTC_MOD_CHANGEMARKER. Sent in response to a change in fold level sent from a client using SetFoldLevel or due to a change in fold level performed by a lexer that supports folding.
top
----
GetLinesAdded
Returns the value of m_linesAdded. Valid for EVT_STC_MODIFIED when GetModificationType() returns one of:
wxSTC_MOD_BEFOREINSERT | wxSTC_PERFORMED_USER
wxSTC_MOD_INSERTTEXT | wxSTC_PERFORMED_USER
wxSTC_PERFORMED_UNDO | wxSTC_MOD_INSERTTEXT
wxSTC_PERFORMED_UNDO | wxSTC_MOD_DELETETEXT
wxSTC_PERFORMED_UNDO | wxSTC_MOD_INSERTTEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_PERFORMED_UNDO | wxSTC_MOD_DELETETEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_PERFORMED_REDO | wxSTC_MOD_INSERTTEXT
wxSTC_PERFORMED_REDO | wxSTC_MOD_DELETETEXT
wxSTC_PERFORMED_REDO | wxSTC_MOD_INSERTTEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_PERFORMED_REDO | wxSTC_MOD_DELETETEXT | wxSTC_LASTSTEPINUNDOREDO
top
----
GetListType
Get the value of m_listType. Valid for EVT_STC_USERLISTSELECTION. Use GetText to get the value of the text returned from this user list.
top
----
GetLParam
Get the value of m_lParam. Valid for EVT_STC_MACRORECORD.
top
----
GetMargin
Returns the value of m_margin. This is the margin number where the click occurred. Valid for EVT_STC_MARGINCLICK. Note that the m_modifieds variable is valid for this event, so you can use GetModifiers or the more convenient GetAlt(), GetControl() and GetShift() methods to determine the state of the modifier keys when the margin was clicked.
top
----
GetMessage
Get the value of m_message. Valid for EVT_STC_MACRORECORD.
top
----
GetModificationType
Get the value of m_modificationType. Used with EVT_STC_MODIFIED to indicate the modification type: see the Modification Types table.
top
----
GetModifiers
Returns the value of m_modifiers. Valid for EVT_STC_MARGINCLICK and EVT_STC_KEY (EVT_STC_KEY not sent in win32).
top
----
GetPosition
Returns the value of m_position. Valid for wxEVT_STC_START_DRAG (lowest character position of start of selection), wxEVT_STC_DO_DROP and wxEVT_STC_DRAG_OVER (both of these send the character position of drop point x,y location), EVT_STC_DWELLEND and EVT_STC_DWELLSTART (both of these send the character position nearest the dwell point or INVALID_POSITION = -1 if not near any text), EVT_STC_STYLENEEDED (last character position where styling is needed) and EVT_STC_MODIFIED when GetModificationType() returns:
wxSTC_MOD_CHANGEMARKER (position may be zero, see Document.cxx in Scintilla src)
wxSTC_MOD_CHANGEFOLD | wxSTC_MOD_CHANGEMARKER
wxSTC_MOD_BEFOREDELETE | wxSTC_PERFORMED_USER
wxSTC_MOD_DELETETEXT | wxSTC_PERFORMED_USER
wxSTC_MOD_BEFOREINSERT | wxSTC_PERFORMED_USER
wxSTC_MOD_INSERTTEXT | wxSTC_PERFORMED_USER
wxSTC_PERFORMED_UNDO | wxSTC_MOD_INSERTTEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_PERFORMED_UNDO | wxSTC_MOD_DELETETEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_PERFORMED_REDO | wxSTC_MOD_INSERTTEXT
wxSTC_PERFORMED_REDO | wxSTC_MOD_DELETETEXT
wxSTC_PERFORMED_REDO | wxSTC_MOD_INSERTTEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_PERFORMED_REDO | wxSTC_MOD_DELETETEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_MOD_CHANGESTYLE | wxSTC_PERFORMED_USER
top
----
GetShift
Returns the state of the SHIFT bit in the m_modifiers attribute; i.e., is 1 if the SHIFT key was pressed for this event. Valid for EVT_STC_MARGINCLICK and EVT_STC_KEY (EVT_STC_KEY not sent in win32).
top
----
GetText
Get the value of the m_text variable. This is valid for wxEVT_STC_USERLISTSELECTION, wxEVT_STC_URIDROPPED, and wxEVT_STC_MODIFIED when GetModificationType() returns:
wxSTC_MOD_BEFOREDELETE | wxSTC_PERFORMED_USER
wxSTC_MOD_INSERTTEXT | wxSTC_PERFORMED_USER
wxSTC_PERFORMED_UNDO | wxSTC_MOD_INSERTTEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_PERFORMED_UNDO | wxSTC_MOD_DELETETEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_PERFORMED_REDO | wxSTC_MOD_INSERTTEXT
wxSTC_PERFORMED_REDO | wxSTC_MOD_DELETETEXT
wxSTC_PERFORMED_REDO | wxSTC_MOD_INSERTTEXT | wxSTC_LASTSTEPINUNDOREDO
wxSTC_PERFORMED_REDO | wxSTC_MOD_DELETETEXT | wxSTC_LASTSTEPINUNDOREDO
top
----
GetWParam
Get the value of m_wParam. Valid for EVT_STC_MACRORECORD.
top
----
GetX
GetY
Get the value of the m_x or m_y variables. These are valid for exEVT_STC_DO_DROP, wxEVT_STC_DRAG_OVER, EVT_STC_DWELLEND and EVT_STC_DWELLSTART.
top
----
SetDragAllowMove
When a drop source, control which operations may take place. Use one of the wxPython defined values:
wxDrag_CopyOnly: allow only copying
wxDrag_AllowMove: allow moving and copying
wxDrag_DefaultMove: the default operation is move rather than copy.
top
----
SetDragResult
Set the value of the m_dragResult variable. You can use one of the wxPython defined values:
wxDragError: error prevented the d&d operation from completing
wxDragNone: drag target didn't accept the data
wxDragCopy: the data was successfully copied
wxDragMove: the data was successfully moved (MSW only)
wxDragLink: operation is a drag-link
wxDragCancel: the operation was cancelled by user (not an error)
top
----
SetDragText
Set the value of m_dragText.
top
----
SetFoldLevelNow
Set the value of m_foldLevelNow.
top
----
SetFoldLevelPrev
Set the value of m_foldLevelPrev.
top
----
SetKey
Set the value of m_key.
top
----
SetLength
Set the value of m_length.
top
----
SetLine
Set the value of m_line.
top
----
SetLinesAdded
Set the value of m_linesAdded.
top
----
SetListType
Set the value of m_listType.
top
----
SetLParam
Set the value of m_lParam.
top
----
SetMargin
Set the value of m_margin.
top
----
SetMessage
Set the value of m_message.
top
----
SetModificationType
Set the value of m_modificationType.
top
----
SetModifiers
Set the value of m_modifiers.
top
----
SetPosition
Set the value of m_position.
top
----
SetText
Set the value of m_text.
top
----
SetWParam
Set the value of m_wParam.
top
----
SetX
Set the value of m_x.
top
----
SetY
Set the value of m_y.
top
----