Autocompletion displays a list box showing likely identifiers based upon the user’s typing. The user chooses the currently selected item by pressing the tab character or another character that is a member of the fillup character set defined with auto_c_set_fillups(). Autocompletion is triggered by your application. For example, in C if you detect that the user has just typed fred. you could look up fred, and if it has a known list of members, you could offer them in an autocompletion list. Alternatively, you could monitor the user’s typing and offer a list of likely items once their typing has narrowed down the choice to a reasonable list. As yet another alternative, you could define a key code to activate the list.

When the user makes a selection from the list the container is sent a auto-c-selection notification message. On return from the notification Scintilla will insert the selected text unless the autocompletion list has been cancelled, for example by the container sending gtkscintilla.Scintilla.auto_c_cancel().

gtkscintilla.Scintilla.auto_c_show(lenEntered, list)

This message causes a list to be displayed. lenEntered is the number of characters of the word already entered and list is the list of words.

The list of words should be in sorted order. If set to ignore case mode with auto_c_set_ignore_case(), then strings are matched after being converted to upper case. One result of this is that the list should be sorted with the punctuation characters ‘[‘, ‘’, ‘]’, ‘^’, ‘_’, and ‘`’ sorted after letters.

This method cancels any displayed autocompletion list. When in autocompletion mode, the list should disappear when the user types a character that can not be part of the autocompletion, such as ‘.’, ‘(‘ or ‘[‘ when typing an identifier. A set of characters that will cancel autocompletion can be specified with gtkscintilla.Scintilla.auto_c_stops() .
This message returns non-zero if there is an active autocompletion list and zero if there is not.
This returns the value of the current position when auto_c_show() started display of the list.
This method triggers autocompletion. This has the same effect as the tab key.
The chars argument is a string containing a list of characters that will automatically cancel the autocompletion list. When you start the editor, this list is empty.
This method selects an item in the autocompletion list. It searches the list of words for the first that matches select. By default, comparisons are case sensitive, but you can change this with auto_c_set_ignore_case(). The match is character by character for the length of the select string. That is, if select is “Fred” it will match “Frederick” if this is the first item in the list that begins with “Fred”. If an item is found, it is selected. If the item is not found, the autocompletion list closes if auto-hide is true (see auto_c_set_separator()). The current selection can be retrieved with gtkscintilla.Scintilla.auto_c_get_current() .
The default behavior is for the list to be cancelled if the caret moves before the location it was at when the list was displayed. By calling this method with a false argument, the list is not cancelled until the caret moves before the first character of the word being completed.
If a fillup character is typed with an autocompletion list active, the currently selected item in the list is added into the document, then the fillup character is added. Common fillup characters are ‘(‘, ‘[‘ and ‘.’ but others are possible depending on the language. By default, no fillup characters are set.
If you use auto_c_set_choose_single() (1) and a list has only one item, it is automatically added and no list is displayed. The default is to display the list even if there is only a single item.
By default, matching of characters to list members is case sensitive. These messages let you set and get case sensitivity.
By default, the list is cancelled if there are no viable matches (the user has typed characters that no longer match a list entry). If you want to keep displaying the original list, set autoHide to false. This also effects auto_c_select().
When an item is selected, any word characters following the caret are first erased if dropRestOfWord is set True. The default is False.
gtkscintilla.Scintilla.register_image(type, xpmData)
Autocompletion list items may display an image as well as text. Each image is first registered with an integer type. Then this integer is included in the text of the list separated by a ‘?’ from the text. For example, [“fclose?2” ,”fopen”] displays image 2 before the string “fclose” and no image before “fopen”. The images are in XPM format as is described for marker_define_pixmap() The set of registered images can be cleared with clear_registered_images() and the ‘?’ separator changed with auto_c_set_type_separator().
Get or set the maximum number of rows that will be visible in an autocompletion list. If there are more rows in the list, then a vertical scrollbar is shown. The default is 5.
Get or set the maximum width of an autocompletion list expressed as the number of characters in the longest item that will be totally visible. If zero (the default) then the list’s width is calculated to fit the item with the most characters. Any items that cannot be fully displayed within the available width are indicated by the presence of ellipsis.

Previous topic


Next topic


This Page