brunotoira Posted June 2, 2014 Share Posted June 2, 2014 Hello, I need to setup UniEdit to accept only chars: 0..9 and "," Backspace and "-" to negative numbers. i create this function, but if i press "." (point) doesnt change to "," (comma) Anyway to do this? procedure TDataModule1.AllowedChars(Sender: TObject; var Key: Char); begin If sender is TUniEdit then Begin if charinset(Key,[backspace, '0'..'9'])=True then exit; if ((Key = '.')OR(Key = ',')) and (Pos(',', TUniEdit(sender).Text) = 0) {and (TUniEdit(sender).s <> 0)} then BEGIN KEY:=','; exit; END; if (Key = '-') {and (TUniEdit(sender).SelStart = 0)} and (pos('-',TUniEdit(sender).text)=0) then exit; Key := #0; end; end; Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted June 2, 2014 Administrators Share Posted June 2, 2014 TuniNumberEdit Link to comment Share on other sites More sharing options...
brunotoira Posted June 3, 2014 Author Share Posted June 3, 2014 Thanks Mr Farshad!! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now