WxPython Styledtextctrl Events

Source: Internet
Author: User
Tags eol httrack

Wxstyledtextctrl-events

Copyright and License Information Home

__ A B C D E F G H I L M P R S T U V W

Wxstyledtextctrl-events

Event Masking

    • Getmodeventmask
    • Setmodeventmask
Events
  • evt_stc_c hange
  • evt_stc_charadded
  • evt_stc_do_drop
  • evt_stc_doubleclick
  • Evt_st C_drag_over
  • evt_stc_dwellend
  • evt_stc_dwellstart
  • evt_stc_key
  • evt_stc_macrorecord
  • evt_stc_marginclick
  • evt_stc_modified
  • Li>evt_stc_needshown
  • evt_stc_painted
  • evt_stc_poschanged
  • evt_stc_romodifyattempt< /li>
  • evt_stc_savepointleft
  • evt_stc_savepointreached
  • E Vt_stc_start_drag
  • evt_stc_styleneeded
  • evt_stc_updateui
  • evt_stc_uridropped
  • evt_stc_userlistselection
  • evt_stc_zoom

Summary:

These is the events used by the STC to send notifications to your application about events within itself. You set up the issuing Ofthese events by adding the appropriateevt_stc_xxx in the subclass of the Wxstyledtextctrl so you CR Eate or in a window, holds an attr, that's an instance of a STC (althoughthis latter approach can is more difficult to Manage).

This section also shows how to set the event mask for Evt_stc_change and evt_stc_modified.

Also See wxstyledtextevent for a description of the event object passed to the target event for all of these event types. References to C + + source code can be found in the Wxwindows sourcecode under the CONTRIB/SRC/STC subdirectory structure.

Finally, since the STC is a subclass of Wxcontrol, which itself is a subclass of Wxwindow, Wxevthandler, and Wxobject, oth ER event handlers (evt_***) is useful as well. For the stc,the following events is among those that is the most useful:

    • Evt_key_down:grab keystrokes before they get to the STC for Calltips, autocompletion, and other processing. Be sure to use event. Skip () If you don ' t consume the keystroke andwant it to go to the STC.
    • Evt_char:handy for Autocompletion and Calltips. Note that if you use Evt_key_down and does not end the IT with event. Skip () then the Evt_char won ' t occur. You usually want to end this inevent. Skip (), but not always.
    • Evt_right_down:use to popup a menu. Be sure to use Usepopup (0) first!

Event Masking

Setmodeventmask (Mask)

Getmodeventmask ()

You can control what types of modifications would fire a evt_stc_change and Evt_stc_modified event with theSetmodeventm Ask (mask) command. The Mask parameter is a ORing of (uaually at least,) of the maskvalues from the list below. Returns None.

Getmodeventmask 'll return the mask value.

Mask Values

Wxstc_mod_inserttextwxstc_mod_deletetextwxstc_mod_changestylewxstc_mod_changefoldwxstc_performed_user ( Performed by user) Wxstc_performed_undo (performed during UNDO) Wxstc_performed_redo (performed during REDO) wxstc_ Laststepinundoredowxstc_mod_changemarkerwxstc_mod_beforeinsertwxstc_mod_beforedeletewxstc_modeventmaskall

Note: For the MOD and performed flag bits, need to set at least one bit from each group; For example:

Wxstc_mod_deletetext | Wxstc_performed_user

Using Wxstc_mod_deletetext by itself would is incorrect.

Events

Evt_stc_change (Win, ID, func)

Evt_stc_change is sent to your application whenever a change was made to the text of the document, except for style changes , which is ignored.

You can control what types of modifications would fire a Evt_stc_change event with the Setmodeventmask command.

The event mask is set to enable all sources (Sc_modeventmaskall) when the STC is initialized. See Event Mask constants.

important! No modifications May is performed while servicing this event!!

No special attributes is set by this event. You're only aware the a change occurred.

Top

evt_stc_charadded (Win, ID, func)

This event occurs if a character is added. The Wxstyledtextevent.getkey () method is used to retrieve the character. Note that the value returned by GetKey may actually is a multi-byte characters see editor.cxx, specifically Editor::addcha RUTF. Also, in the case of a EOL, the value returned by GetKey May is part of a two-character EOL like \ r \ n. In this case, multiple notifications is sent. See Editor.cxx:editor::newline ()

Top

Evt_stc_do_drop (Win, ID, func)

This event was sent in response to a text drop as part of a drag-n-drop where the STC is the drop destination. The STC sets a drop target for itself when it's instantiated and the text drop is translated into a Evt_stc_do drop event That's you can handle if you wish to change some characteristic of the drop. The attributes available are:x, y, Position, dragtext, and Dragresult. Dragresult, position, and dragtext. Top

Evt_stc_doubleclick (Win, ID, func)

This event was sent when a double-click occurs. No special information is provided.

Top

Evt_stc_drag_over (Win, ID, func)

This event was called when the mouse was being dragged over the drop target. The attributes available are:x, Y, Position, and Dragresult. Change Dragresult.

Top

Evt_stc_dwellend (Win, ID, func)

The Dwellend event is sent after a dwellstart and the mouse are moved or other activity such as a keypress indicates that T He dwell is over.

Top

Evt_stc_dwellstart (Win, ID, func)

The Dwellstart event is sent when the mouse have not moved in the amount of time defined by Wxstyledtextctrl.setmousedwellt IME (). This method was used to set the time (in milliseconds) that the mouse must not move in order to fire a Dwellstart event. If set to Sc_time_forever (which was the default) then no dwell events is generated.

Note:sc_time_forever isn't defined in WxPython. Its value is:10000000.

Top

Evt_stc_key (Win, ID, func)

The Scintilla documentation says:

Reports all keys pressed. Used on GTK + because of some problems with keyboard focus. Not sent by Windows version.

As far as the this writer can tell, this means the this event, although technically available thru wxwindows, would not actual Ly ever occur.

Top

Evt_stc_macrorecord (Win, ID, func)

This event lets your know that some operation have occurred so the can record it if you wish to provide a Macro-recordi NG facility. The attributes message, WParam and LParam are available. See Editor.cxx:editor::notifymacrorecord to see which messages is passed thru to the event.

Top

Evt_stc_marginclick (Win, ID, func)

This event is indicates, the active margin has been clicked. The Available attributes Are:modifiers (Getalt, Getshift, Getctrl), position (always at the start of the use is on; i.e., the column would be 0), and margin (the margin number is clicked). Note that if a margin was clicked by isn ' t active then no event would occur.

Top

evt_stc_modified (Win, ID, func)

Evt_stc_modified is sent to your application whenever a change was made to the text of the document, including style change S.

You can control what types of modifications would fire a evt_stc_modified event with the Setmodeventmask command.

The event mask is set to enable all sources (Sc_modeventmaskall) when the STC is initialized. See Event Mask constants.

important! No modifications May is performed while servicing this event!!

Attributes set by this event are:position, Modificationtype (which'll be is one of the modifications selected by Setmodeve Ntmask), text, length, linesadded, line, Foldlevelnow, and Foldlevelprev.

Top

Evt_stc_needshown (Win, ID, func)

This event occurs if lines that is hidden should be made visible. An example of where this may needed are if the end of line of a contracted fold point is deleted.

This message was sent to the container in case it wants to make the line visible in some unusual a-such as making the WHO Le document visible. Most containers would just ensure each line in the range are visible by calling Sci_ensurevisible.

Attributes set by this event is length and position.

N.B. This was copied from the Scintilla documentation. Author unsure how to use it.

Top

evt_stc_painted (Win, ID, func)

This event occurs at the end of Editor.cxx:Editor:Paint () and after all Painting are complete. The Scintilla Dox say:

No Special attributes available, you have know that a paint operation have occurred.

Top

evt_stc_poschanged (Win, ID, func)

This event occurs if the position within the document is changed. The attribute position is set.

Top

evt_stc_romodifyattempt (Win, ID, func)

This event was sent when there's a attempt to modify a read-only Document. There ' s no special information for this event.

Top

Evt_stc_savepointleft (Win, ID, func)

evt_stc_savepointreached (Win, ID, func)

From the Scintilla dox:

There ' s no special information for this event.

Top

Evt_stc_start_drag (Win, ID, func)

This event was sent when a drag operation begins with the STC as the source of the drag (unlike Evt_stc_do_drop). The attributes Dragtext, Dragallowmove, and position are set. Modify the Dragallowmove parameter (see Setdragallowmove and Getdragallowmove, and Dragtext.

Top

evt_stc_styleneeded (Win, ID, func)

This event was sent when the text is displayed or printed. The client can ensure that the styling information are appropriate for the visible text. Most useful for syntax styling information. The position attribute is set to the last character position where styling is needed.

Top

Evt_stc_updateui (Win, ID, func)

This event occurs during Editor.cxx:Editor:Paint (), if a change have been made to the text, the styling, or the selection. Used to update the any GUI elements this should change as a result. Useful for performing brace highlighting, and other tasks, the can be performed using background processing.

Top

evt_stc_uridropped (Win, ID, func)

The Scintilla dox state:

Top

evt_stc_userlistselection (Win, ID, func)

Fired after an item in a user list is selected. Use Wxstyledtextctrl.getlisttype and. GetText to retrieve the values of the ListType and text attributes set by this event. Note:at the time of this writing (Nov 2002) Getlisttype would always return 0. This would probably is fixed by the time you read this and unless you is using an old version of WxPython.

Top

Evt_stc_zoom (Win, ID, func)

This event occurs when the Zoom have been changed:usually by a human using the keyboard keys which is mapped to the Zoomi N and Zoomout functions, or by the Mouse-wheeel. Can also is triggered by programmatic use of the Setzoom method.

Top

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.