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
| //------------------------------------------------------------------------------
function TFormSliteHelper.EnterAsTab(var Key: Char): Boolean;
begin
if Key = Chr(CarriageReturn) then
begin
Result := True;
if LongBool(GetAsyncKeyState(VK_SHIFT) and $8000) then
SelectPriorControl()
else
SelectNextControl();
Key := #0; // Evite le "dong" !
end
else
Result := False;
end;
//------------------------------------------------------------------------------
procedure TFormSliteHelper.SelectNextControl();
begin
// TControl.SelectNext est une méthode protégée
// le plus simple pour passer au controle suivant c'est le message Windows
Self.Perform(WM_NEXTDLGCTL, 0, 0);
end;
//------------------------------------------------------------------------------
procedure TFormSliteHelper.SelectPriorControl();
begin
// If wParam is zero, the next control receives the focus; otherwise, the previous control with the WS_TABSTOP style receives the focus.
Self.Perform(WM_NEXTDLGCTL, 1, 0);
end; |
Partager