Einzelnen Beitrag anzeigen

Benutzerbild von Lannes
Lannes

Registriert seit: 30. Jan 2005
Ort: Münster
745 Beiträge
 
Delphi 3 Professional
 
#6

Re: Checkbox / KeyDown, KeyPress, KeyUp

  Alt 14. Sep 2006, 07:39
Hallo,

Pfeiltasten in Checkbox abfangen? CM_DIALOGKEY abfangen.

so ähnlich:
Delphi-Quellcode:
//...
private
  procedure CMDialogKey(var Message: TCMDialogKey); message CM_DIALOGKEY;
//...
procedure TForm1.CMDialogKey(var Message: TCMDialogKey);
begin
  with message do begin
    case charcode of
    VK_LEFT,VK_UP : if ActiveControl is TCheckBox then
                         SendMessage(Self.Handle,WM_NEXTDLGCTL,1,0);
    VK_RIGHT,VK_DOWN : if ActiveControl is TCheckBox then
                         SendMessage(Self.Handle,WM_NEXTDLGCTL,0,0);
    else
      inherited;//Standardverhalten sicherstellen
    end;
  end;
end;
Mit WM_NEXTDLGCTL wird das nächste Element entsprechend TabOrder/TapStop fokussiert.
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
  Mit Zitat antworten Zitat