Good morning!
In Delphi I use this routine to make an edit to the same bank ATMs.
TForm1.Edit1KeyPress procedure (Sender: TObject; var Key: Char);
begin
if not (Key in ['0 '.. '9', # 8, # 9]) then
key: = # 0;
/ / Function to position the cursor always on the right
Edit1.SelStart: Length = (Edit1.Text);
end;
then the change type well
var
s: string;
v: double;
I: integer;
begin
/ / Step 1: If the edit is empty, nothing can be done.
If (= Edit1.Text emptystr) then
Edit1.Text: = '0, 00 ';
/ / Step 2: get the text edit WITHOUT a comma and WITHOUT the decimal point:
s: ='';
for I: length = 1 to (Edit1.Text) of
if (Edit1.Text in ['0 '.. '9']) then
s: = s + Edit1.Text ;
/ / Step 3: make edit the contents of the present two decimal places:
v: = strtofloat (s);
v: = (v / 100) / / to create two decimal places
/ / Step 4: Format of the value (V) for accepting values of the type 0.10.
Edit1.Text: FormatFloat = ('# # #, # # 0.00', v);
edit1.SelStart: = 0;
end;
is how to do this uniedit???