[Gtk-sharp-list] EntryCompletition and MatchSelected event
Venturelli, Roberto
roberto at robertoventurelli.com
Fri Jan 4 12:00:48 UTC 2013
Hi,
I'm new with GTK# and I have a problem with an EntryCompletition which is
not firing the MatchSelected event.
This is the code that is in a subclassed Entry class:
public void FillCompletion()
{
ListStore store = new ListStore(typeof(string), typeof(string));
store.AppendValues("One", "Apple");
store.AppendValues("Two", "Banana");
store.AppendValues("Three", "Orange");
base.Completion = new EntryCompletion();
base.Completion.MatchSelected += Completion_MatchSelected;
base.Completion.Model = store;
CellRendererText column1 = new CellRendererText();
base.Completion.PackStart(column1, false);
base.Completion.AddAttribute(column1, "text", 0);
CellRendererText column2 = new CellRendererText();
base.Completion.PackStart(column2, false);
base.Completion.AddAttribute(column2, "text", 1);
base.Completion.MatchFunc = delegate(EntryCompletion completion, stringkey,
TreeIter iter)
{
string val1 = Convert.ToString(completion.Model.GetValue(iter, 0));
string val2 = Convert.ToString(completion.Model.GetValue(iter, 1));
return (val1.ToLower().StartsWith(key.ToLower()) ||
val2.ToLower().StartsWith(key.ToLower()));
};
}
private void Completion_MatchSelected(object o, MatchSelectedArgs args)
{
// Event never fired!!!
base.Text = Convert.ToString(args.Model.GetValue(args.Iter, 0));
}
I've tried also with other EntryCompletition events (CursorOnMatch,
ActionActivated and PrefixInserted), but none of these works...
Any ideas???
Thanks,
Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20130104/729932b7/attachment.html>
More information about the Gtk-sharp-list
mailing list