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
| unit uCaisseAOutils;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Math, Buttons, ExtCtrls;
type
TFormCaisseAOutils = class(TForm)
EditNumerique: TEdit;
.....
procedure EditNumeriqueKeyPress(Sender: TObject; var Key: Char); // ça marche même sans mettre cette procedure dans les déclarations publiques
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
FU1 : TFormCaisseAOutils;
implementation
{$R *.DFM}
procedure TForm1.EditNumeriqueKeyPress(Sender: TObject; var Key: Char);
begin if not (Key in ['0'..'9', DecimalSeparator, Chr(VK_BACK), Chr(VK_DELETE)])
then Key := #0;
if Key = DecimalSeparator
then if Pos(DecimalSeparator, (Sender as TEdit).Text) <> 0 then Key := #0;
end; |
Partager