gtk-sharp[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4]2.12.0.0Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.
This object allows a widget to suggest possible completions of a string which has been partially entered.
The partially-entered string is also referred to as a "key".
using System;
using Gtk;
public class DemoEntryCompletion : Window
{
static void Main ()
{
Application.Init ();
new DemoEntryCompletion ();
Application.Run ();
}
public DemoEntryCompletion () : base ("Demo Entry Completion")
{
this.BorderWidth = 10;
this.Resizable = false;
VBox vbox = new VBox ();
Label label = new Label ("Completion demo, try writing <b>total</b> or </b>gnome</b> for example.");
label.UseMarkup = true;
vbox.PackStart (label, false, true, 0);
Entry entry = new Entry ();
entry.Completion = new EntryCompletion ();
entry.Completion.Model = CreateCompletionModel ();
entry.Completion.TextColumn = 0;
vbox.PackStart (entry, false, true, 0);
this.Add (vbox);
this.ShowAll ();
}
TreeModel CreateCompletionModel ()
{
ListStore store = new ListStore (typeof (string));
store.AppendValues ("GNOME");
store.AppendValues ("total");
store.AppendValues ("totally");
return store;
}
}
GLib.ObjectGtk.CellLayoutMethodSystem.VoidThis method is called whenever an action is activated.
a MethodSystem.BooleanThis method is called whenever the user selects one of the suggested matches.
a , the model the match was selected from
a , the row the user picked
a MethodSystem.Void
Inserts an action in the completion's action item list at
position with markup
.
a
a MethodSystem.Void
Inserts an action in the completion's action item list at
position with text
.
a
a
If you want the item to have markup, use .
MethodSystem.Void
Requests a completion operation, or in other words a refiltering
of the current list with completions, using the current key. The
completion list view will be updated accordingly.
MethodSystem.Void
Deletes the action at
from the action list for this completion.
a MethodSystem.Void
Reinserts into the completion list
at .
a
a MethodSystem.VoidAdds the to the end of the entry-completion widget.
a
a
If is , then the
is allocated no more space than it needs. Any unused space is
divided evenly between cells for which is .
MethodSystem.VoidPacks the into the beginning of the entry-completion widget.
a
a
If is , then the
is allocated no more space than it needs. Any unused space is
divided evenly between cells for which is .
MethodSystem.Void
Adds an attribute mapping to the list in this entry-completion widget.
a
a , parameter on to be set from the value
a , column of the model to get a value from.
The is the column of the model to get a value from, and the is the
parameter on to be set from the value. So for example if column 2
of the model contains strings, you could have the "text" attribute of a
get its values from column 2.
MethodSystem.Void
Clears all existing attributes previously set with
.
a MethodSystem.VoidClears the completion.ConstructorProtected constructor.
a System.ObsoleteConstructorConstructor for internal use only.
a ConstructorConstructor for general use.PropertyGLib.GTypeGType Property.a Returns the native value for .PropertySystem.Int32Minimum string length for enabling completion.a
Requires the length of the search key for this completion to be at least
a certain length. This is useful for long lists, where completing using a small
key takes a lot of time and will come up with meaningless results anyway
(ie, a too large dataset).
GLib.Property("minimum-key-length")PropertySystem.Int32Setting this property generates a completion list with just strings.a
Setting this convenience property will set up the completion
to have a list displaying all (and just) strings in the completion list,
and to get those strings from a particular column number in the model of the completion object.
GLib.Property("text-column")PropertyGtk.Widget
Returns the entry widget this completion object has been attached to.
a EventGtk.ActionActivatedHandler
Event triggered when a particular action is activated.
GLib.Signal("action_activated")EventGtk.MatchSelectedHandlerEvent triggered when the user selects a match.GLib.Signal("match_selected")MethodSystem.VoidSets up a data function for this layout.
a
a
The data function is used instead of the standard attributes mapping for setting the
column value, and should set the value of the layout's cell renderer(s)
as appropriate. may be to remove an older one.
PropertyGtk.TreeModelTree data model.a GLib.Property("model")MethodSystem.VoidSystem.ParamArraySets the attribute to model column bindings for a renderer.
a
a The array should be pairs of attribute names and column indexes.PropertyGtk.EntryCompletionMatchFuncThe matching functiona The match function is used to determine if a row should or should not be in the completion list.PropertySystem.BooleanTo be addeda To be addedGLib.Property("inline-completion")PropertySystem.BooleanTo be addeda To be addedGLib.Property("popup-completion")EventGtk.PrefixInsertedHandlerTo be addedTo be addedGLib.Signal("insert_prefix")MethodSystem.BooleanDefault handler for the event.
a a Override this method in a subclass to provide a default handler for the event.MethodSystem.VoidTo be addedTo be addedPropertyGLib.Property("popup-single-match")System.BooleanControls if popup is displayed on a single match. if popup is displayed on single matches.Set this to for inline completion.PropertyGLib.Property("popup-set-width")System.BooleanControls if the popup is sized to the same width as the entry. if popup size is same as entry size.