[Gtk-sharp-list] Entry EditingDone Event
McP
mariano.cano@hispalinux.es
Fri, 24 Oct 2003 17:30:56 +0200
El vie, 24-10-2003 a las 14:13, Luciano Callero escribió:
> Someone to help me on this? please?
Don't worry, be happy.
You could store the value when the return key was pressed.
void StoreProperty(object o, KeyPressEventArgs args)
{
Gdk.EventKey key = args.Event;
if(key.keyval == (uint) Gdk.Key.Return)
{
XXX.Property = entry1.Text;
}
}
You must to add a KeyPressEvent to you entry.
> >Hi:
> >
> >I've a Gtk Window with an Entry Widget. This entry must update a value
> >(store in a property) after end editing.
> >I think that the EditingDone event that inherit from other its the correct,
> >beacause i need to update when is changed in the entry and not when is
> >change by Programming.
> >
> >This is an "Example":
> >
> >class Test:Window
> >
> > {
> > public string EntryValue = "";
> > static void Main()
> > {
> > Button button1 = new Button("Change The Entry");
> > Entry entry1 = new Entry();
> >
> > // All the code that initialize the window
> >
> > button1.Clicked += new EventHandler(button1_clicked);
> > entry1.EditingDonde += new EventHandler(entry1_editingdone);
> > entry1.OnChange += new EventHandler(entry1_onchange);
> > }
> >
> > public void button1_clicked(System.Object Sender, EventArgs
> >args)
> > {
> > entry1.Text = "Test of Change"; // This must not
> >update the value
> > }
> >
> > public void entry1_editingdone(System.Object Sender, EventArgs
> >args)
> > {
> > // HERE Does Not Enter
> > EntryValue = ((Entry)Sender).Text;
> > }
> >
> > public void entry1_onchange(System.Object Sender, EventArgs args)
> > {
> > Console.WriteLine("This is shown every time.");
> > }
> > }
> >
> >
> >I try 3 thinks:
> >1) Use OnChange event, but the problem was that on every key pressed (every
> >value that is inserted) in the entry is updated automaticaly, and this will
> >be very slow, beacause in realy i need to update a Row in a DataTable, and
> >i must to search some positions and other thinks.
> >The other and the bigger problem is that, if i change the value of the
> >entry internaly (like button1) it is fire the event onChange, and i must to
> >use some "flag" and this is not very efficient. (Not for my)
> >2) The second idea that i have is to use EditingDone Event, but the problem
> >is that it is never fires this event. I dont know if i'm using like it is.
> >
> >
> >The finally Question: Do i have to commit suicide? :) Do i need to start
> >reading again?
> >Is there an event that is fire when end editing, but before that focus is
> >lost. Like a Validate (in m$) event?
> >I'm using correctly the EditingDone Event?
> >
> >Thanks in advance.
> >
> >_________________________________________________________________
> >¿Estás buscando un auto nuevo? http://www.yupimsn.com/autos/
> >
> >_______________________________________________
> >Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com
> >http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
> _________________________________________________________________
> ¿Estás buscando un auto nuevo? http://www.yupimsn.com/autos/
>
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
--
McP <mariano.cano@hispalinux.es>