Exemplo n.º 1
0
 public void HandleTextDeleted(object o, Gtk.TextDeletedArgs args)
 {
     if (!deleting)
     {
         deleting = true;
         if (args.StartPos < args.EndPos)
         {
             var tia = new TextChangingEventArgs(string.Empty, new Range <int>(args.StartPos, Math.Min(args.EndPos - 1, Handler.Control.Text.Length - 1)));
             Handler.Callback.OnTextChanging(Handler.Widget, tia);
             if (tia.Cancel)
             {
                 NativeMethods.g_signal_stop_emission_by_name(Handler.Control.Handle, "delete-text");
             }
         }
         deleting = false;
     }
 }
Exemplo n.º 2
0
 public void HandleTextDeleted(object o, Gtk.TextDeletedArgs args)
 {
     if (!deleting)
     {
         deleting = true;
         if (args.StartPos < args.EndPos)
         {
             var tia = new TextChangingEventArgs(string.Empty, new Range <int>(args.StartPos, Math.Min(args.EndPos - 1, Handler.Control.Text.Length - 1)), true);
             Handler.Callback.OnTextChanging(Handler.Widget, tia);
             if (tia.Cancel)
             {
                 args.RetVal = true;
             }
         }
         deleting = false;
     }
 }
Exemplo n.º 3
0
        protected void PhoneTextDeleted(object o, Gtk.TextDeletedArgs args)
        {
            FormatString(o);
            var Entry = o as Gtk.Entry;

            if (args.StartPos > Entry.Text.Length)
            {
                Entry.Position = Entry.Text.Length;
            }
            else
            {
                Entry.Position = args.StartPos;
            }
            if (args.StartPos == 16 && args.EndPos == 17)                               //Backspace
            {
                Entry.Text     = Entry.Text.Remove(13, 1);
                Entry.Position = 13;
            }
            else if (args.StartPos == 11 && args.EndPos == 12)
            {
                Entry.Text     = Entry.Text.Remove(8, 1);
                Entry.Position = 8;
            }
            else if (args.StartPos == 5 && args.EndPos == 6)
            {
                Entry.Text     = Entry.Text.Remove(3, 1);
                Entry.Position = 3;
            }
            else if (args.StartPos == 14 && args.EndPos == 15)                  //Delete
            {
                Entry.Text     = Entry.Text.Remove(17, 1);
                Entry.Position = 17;
            }
            else if (args.StartPos == 9 && args.EndPos == 10)
            {
                Entry.Text     = Entry.Text.Remove(12, 1);
                Entry.Position = 12;
            }
            else if (args.StartPos == 4 && args.EndPos == 5)
            {
                Entry.Text     = Entry.Text.Remove(6, 1);
                Entry.Position = 6;
            }
        }