Exemplo n.º 1
0
        protected void NumericValidate(object sender, Gtk.TextInsertedArgs Args)
        {
            String Text = (sender as Gtk.Entry).Text;

            Text = Regex.Replace(Text, "[^0-9]", "");
            (sender as Gtk.Entry).Text = Text;
        }
Exemplo n.º 2
0
        protected void PhoneTextInserted(object o, Gtk.TextInsertedArgs args)
        {
            FormatString(o);
            switch (args.Position)
            {
            case 1:
                args.Position += 1;
                break;

            case 4:
                args.Position += 2;
                break;

            case 5:
                args.Position += 2;
                break;

            case 10:
                args.Position += 3;
                break;

            case 15:
                args.Position += 3;
                break;
            }
        }
        private void HandleTextInserted(object o, Gtk.TextInsertedArgs args)
        {
            var entry = o as Gtk.Entry;

            System.Diagnostics.Debug.Assert(object.ReferenceEquals(entry, Editor), "Did not receive text inserted message from the expected Gtk.Entry.");
            entry.TextInserted -= HandleTextInserted; // disconnect so we don't reenter if restricting characters
            var position    = args.Position;
            var currentText = entry.Text;

            foreach (var character in args.Text)
            {
                if (!IsValidCharacter(character))
                {
                    var index = currentText.IndexOf(character);
                    while (index >= 0)
                    {
                        entry.DeleteText(index, index + 1);
                        args.Position = args.Position - 1;
                        currentText   = entry.Text;
                        index         = currentText.IndexOf(character);
                    }
                }
            }

            entry.TextInserted += HandleTextInserted;
        }
Exemplo n.º 4
0
        static void TextInsertedSignalCallback(IntPtr arg0, IntPtr arg1, int arg2, ref int arg3, IntPtr gch)
        {
            Gtk.TextInsertedArgs args = new Gtk.TextInsertedArgs();
            try {
                GLib.Signal sig = ((GCHandle)gch).Target as GLib.Signal;
                if (sig == null)
                {
                    throw new Exception("Unknown signal GC handle received " + gch);
                }

                args.Args    = new object[3];
                args.Args[0] = GLib.Marshaller.Utf8PtrToString(arg1);
                args.Args[1] = arg2;
                args.Args[2] = arg3;
                Gtk.TextInsertedHandler handler = (Gtk.TextInsertedHandler)sig.Handler;
                handler(GLib.Object.GetObject(arg0), args);
            } catch (Exception e) {
                GLib.ExceptionManager.RaiseUnhandledException(e, false);
            }

            try {
                arg3 = ((int)args.Args[2]);
            } catch (Exception) {
                Exception ex = new Exception("args.RetVal or 'out' property unset or set to incorrect type in Gtk.TextInsertedHandler callback");
                GLib.ExceptionManager.RaiseUnhandledException(ex, true);
                // NOTREACHED: above call doesn't return.
                throw ex;
            }
        }
Exemplo n.º 5
0
        //Evento compara valor: desativa botão de confirmação de saque se o valor a sacar for maior que
        //o valor disponível em conta
        protected void OnCmpValorTextInserted(object o, Gtk.TextInsertedArgs args)
        {
            novoValor = float.Parse(cmpValor.Text);
            novoValor = conta.getBalance() - novoValor;

            lblDepois.Text = "R$ " + novoValor;
            if (novoValor < 0)
            {
                btnConfirma.CanFocus  = false;
                btnConfirma.Sensitive = false;
            }
            else
            {
                btnConfirma.CanFocus  = true;
                btnConfirma.Sensitive = true;
            }
        }
Exemplo n.º 6
0
 protected void GetUserName(object o, Gtk.TextInsertedArgs args)
 {
 }
Exemplo n.º 7
0
 protected void GetPassword(object o, Gtk.TextInsertedArgs args)
 {
 }
Exemplo n.º 8
0
		static void TextInsertedSignalCallback (IntPtr inst, IntPtr arg0, int arg1, ref int arg2, IntPtr gch)
		{
			Gtk.TextInsertedArgs args = new Gtk.TextInsertedArgs ();
			try {
				GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
				if (sig == null)
					throw new Exception("Unknown signal GC handle received " + gch);

				args.Args = new object[3];
				args.Args[0] = GLib.Marshaller.Utf8PtrToString (arg0);
				args.Args[1] = arg1;
				args.Args[2] = arg2;
				Gtk.TextInsertedHandler handler = (Gtk.TextInsertedHandler) sig.Handler;
				handler (GLib.Object.GetObject (inst), args);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}

			try {
				arg2 = ((int)args.Args[2]);
			} catch (Exception) {
				Exception ex = new Exception ("args.RetVal or 'out' property unset or set to incorrect type in Gtk.TextInsertedHandler callback");
				GLib.ExceptionManager.RaiseUnhandledException (ex, true);
				// NOTREACHED: above call doesn't return.
				throw ex;
			}
		}
Exemplo n.º 9
0
 public static string GetText(this Gtk.TextInsertedArgs args)
 {
     return(args.Text);
 }
 private void OnTextInsertedEvent(object o, Gtk.TextInsertedArgs args)
 {
     _host._host           = _inputHostTarget.Text.Trim();
     _inputHostTarget.Text = _host._host;
 }