1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| procedure TFRM_Menu.MskEdt_cliLimitCredKeyUp(Sender: TObject;
var Key: Word; Shift: TShiftState);
var
contenu : String;
taille : Integer;
begin
contenu := MskEdt_cliLimitCred.Text;
contenu := AnsiReplaceStr(contenu,'.','');
contenu := AnsiReplaceStr(contenu,',','');
taille := Length(contenu);
if Key in [VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4,
VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9] then
case taille of
0, 1, 2 : ;
3 : Insert(',',contenu, 2);
4 : begin
contenu := AnsiRightStr(contenu, 3)+AnsiLeftStr(contenu, 1);
Insert(',',contenu, 3);
end;
5 : begin
contenu := AnsiRightStr(contenu, 4)+AnsiLeftStr(contenu, 1);
Insert(',',contenu, 4);
end;
6 : begin
contenu := AnsiRightStr(contenu, 5)+AnsiLeftStr(contenu, 1);
Insert(',',contenu, 5);
Insert('.',contenu, 2);
end;
7 : begin
contenu := AnsiRightStr(contenu, 6)+AnsiLeftStr(contenu, 1);
Insert(',',contenu, 6);
Insert('.',contenu, 3);
end;
8 : begin
contenu := AnsiRightStr(contenu, 7)+AnsiLeftStr(contenu, 1);
Insert(',',contenu, 7);
Insert('.',contenu, 4);
end;
9 : begin
contenu := AnsiRightStr(contenu, 8)+AnsiLeftStr(contenu, 1);
Insert(',',contenu, 8);
Insert('.',contenu, 5);
Insert('.',contenu, 2);
end;
10 : begin
contenu := AnsiRightStr(contenu, 9)+AnsiLeftStr(contenu, 1);
Insert(',',contenu, 9);
Insert('.',contenu, 6);
Insert('.',contenu, 3);
end
else
begin
contenu := AnsiRightStr(contenu, 10)+AnsiLeftStr(contenu, 1);
Insert(',',contenu, 10);
Insert('.',contenu, 7);
Insert('.',contenu, 4);
end;
end;
MskEdt_cliLimitCred.Text := contenu;
end; |
Partager