Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question// Mettre la proprité KeyPreview de Form1 à true (interception des événements-clavier) et créer la procedure suivante : procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin case Key of VK_RETURN : Key := VK_TAB; end; if (Not (ssShift in sHIFT)) // Point-virgule = minuscule and (key=190) // Touche point et point-virgule then begin showmessage('point virgule'); Key:=VK_Space; end; if (GetAsyncKeyState(VK_RMENU)<>0) // Touche AltGr à droite and (Key=52) // Touche de l'apostrophe et du 4 then begin showmessage('apostrophe'); Key:=VK_Space; end; showMessage(chr(key)); end;
ouai mais il est pas terrible ce code
procedure FormKeyPress(Sender: TObject; var Key: Char); private { Déclarations privées } Procedure CMDialogKey(Var Msg : TWMKey) ; message CM_DIALOGKEY ; public { Déclarations publiques } cb3, erreur, ctl1, ctl2, cpt1, cpt2, cpt3 : Integer ; cb2, cbrest : Int64 ; PPT, Fen, cb1, Proven, Comp : String ; // Proven = provenance PP pr Décision PPAN, PPNU : Integer ; PPOR, PPPRO : String ; mand1, mand2, mand3, mand4, mand5, mand6, mand7, mand8, mand9 : String; End ; Var FPP : TFPP ; Implementation Uses Calis, Bien, SelPP, VicPropPP, PersMor, Datas, Datas1, Decision, Admin, PaiePP, FSupprPP, Mandat ; {$R *.dfm} Procedure TFPP.CMDialogKey(Var Msg : TWMKey) ; Begin If Not (ActiveControl Is TButton) Then Begin If Msg.Charcode = VK_RETURN Then Msg.Charcode := VK_TAB ; End; Inherited ; End ; procedure TFPP.FormKeyPress(Sender: TObject; var Key: Char); begin if (Key '''') or (Key ';')then Key := #32 else if Key = #13 then Key := #9; end;