Copyright and License information Home
__ A B C D E F G H I L M P R S T U V W
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
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.
topCreate a copy of the event. Required by wxWindows event system.
topReturns 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).
topReturns 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).
topGet the value of the m_dragAllowMove. Always initially set TRUE for the EVT_STC_START_DRAG event. See SetDragAllowMove for more information.
topGet the value of m_dragResult. See SetDragResult.
topGet the value of m_dragText. This is a string that contains text to be dropped into the STC.
topGet the value of m_foldLevelNow. The fold level after to a change in folding level. See also GetFoldLevelPrev.
topGet 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).
topReturns the value of m_key. This is valid for EVT_STC_CHARADDED and EVT_STC_KEY (ECT_STC_KEY not used in win32).
topReturns the value of m_length. This is valid for EVT_STC_NEEDSHOWN and EVT_STC_MODIFIED.
topReturns 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.
topReturns the value of m_linesAdded. Valid for EVT_STC_MODIFIED when GetModificationType() returns one of:
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.
topGet the value of m_lParam. Valid for EVT_STC_MACRORECORD.
topReturns 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.
topGet the value of m_message. Valid for EVT_STC_MACRORECORD.
topGet the value of m_modificationType. Used with EVT_STC_MODIFIED to indicate the modification type: see the Modification Types table.
topReturns the value of m_modifiers. Valid for EVT_STC_MARGINCLICK and EVT_STC_KEY (EVT_STC_KEY not sent in win32).
topReturns 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:
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).
topGet the value of the m_text variable. This is valid for wxEVT_STC_USERLISTSELECTION, wxEVT_STC_URIDROPPED, and wxEVT_STC_MODIFIED when GetModificationType() returns:
Get the value of m_wParam. Valid for EVT_STC_MACRORECORD.
topGet 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.
topWhen a drop source, control which operations may take place. Use one of the wxPython defined values:
Set the value of the m_dragResult variable. You can use one of the wxPython defined values:
Set the value of m_dragText.
topSet the value of m_foldLevelNow.
topSet the value of m_foldLevelPrev.
topSet the value of m_key.
topSet the value of m_length.
topSet the value of m_line.
topSet the value of m_linesAdded.
topSet the value of m_listType.
topSet the value of m_lParam.
topSet the value of m_margin.
topSet the value of m_message.
topSet the value of m_modificationType.
topSet the value of m_modifiers.
topSet the value of m_position.
topSet the value of m_text.
topSet the value of m_wParam.
topSet the value of m_x.
topSet the value of m_y.
top