Permalink
Browse files

Edit Number Option einprogrammiert.

Unter der Option sind dan folgende keys verfügbar:
"0","1","2","3","4","5","6","7","8","9",",",".","Backspace

wenn ich welche vergessen habe...anschreiben..
  • Loading branch information...
1 parent 2a9e4cb commit 26da97cd3666493a8b1044ae6f3f860cce3bb467 @RaptorOne committed Feb 27, 2011
Showing with 15 additions and 2 deletions.
  1. +15 −2 Rusty/Cores/Gui/Gui.cs
@@ -477,11 +477,11 @@ static void GuiControlEdit(ref Control control, Form parent, string type, string
case Keyword_Lowercase: edit.CharacterCasing = on ? CharacterCasing.Lower : CharacterCasing.Normal; break;
case Keyword_Multi: edit.Multiline = on; break;
- case Keyword_Number: break;
+ case Keyword_Number: edit.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Edit_Number); break;
case Keyword_Password: edit.PasswordChar = ''; break;
case Keyword_Readonly: edit.ReadOnly = on; break;
case Keyword_Uppercase: edit.CharacterCasing = on ? CharacterCasing.Upper : CharacterCasing.Normal; break;
- case Keyword_WantCtrlA: break;
+ case Keyword_WantCtrlA: break; //I dont see that the normal ctrl+A works! perhaps new implementation?
case Keyword_WantReturn: edit.AcceptsReturn = on; break;
case Keyword_WantTab: edit.AcceptsTab = on; break;
case Keyword_Wrap: edit.WordWrap = on; break;
@@ -1864,5 +1864,18 @@ public static void GuiControlGet(out object result, string command, string contr
break;
}
}
+
+
+ /*
+ * Delegates
+ */
+
+ private static void Edit_Number(object sender, KeyPressEventArgs e)
+ {
+ if (!(char.IsDigit(e.KeyChar) || char.IsNumber(e.KeyChar) || e.KeyChar == '.' || e.KeyChar == ',' || (int)e.KeyChar == 8 || (int)e.KeyChar == 58 || (int)e.KeyChar == 59))
+ {
+ e.Handled = true;
+ }
+ }
}
}

0 comments on commit 26da97c

Please sign in to comment.