Autor Beitrag
motion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 295

XP, Linux
D7 Prof
BeitragVerfasst: Fr 18.11.05 11:24 
Ich muss in Checkboxen eigene Funktionen beim Drücken der Cursortasten realisieren. Leider feuern diese nicht ...

Das ist wohl irgendwie ein Windows Problem, das Tbuttons (und Tcheckbox ist davon abstammend) diese Messages nicht bekommen.
Gibt's da eine andere Möglichkeit, wie ich an die Cursortasten in meiner Checkbox rankomme?
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Fr 18.11.05 11:28 
Weiss nicht, ob das funktioniert, aber könntest du nicht die Cursortasten auf dem Form abfangen ( per KeyPreview = true ), das fokussierte Control herausfinden und dann die entsprechende Funktion aufrufen?

Wie gesagt, nur eine Idee ins blaue...

_________________
Bravery calls my name in the sound of the wind in the night...
motion Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 295

XP, Linux
D7 Prof
BeitragVerfasst: Fr 18.11.05 11:38 
Habe gerade eine Lösung gefunden (auf Komponentenebene, da ich eine eigene Txxx_Checkbox erstelle):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Txxx_Checkbox = class(TCheckBox)
private
 Procedure CMWantspecialKey(var Msg : TWMKey); message CM_WANT
SpecialKey;
End;

Procedure Txxx_Checkbox.CMWantSpecialKey (var Msg : TWMKey);
Begin
  inherited;
  with msg do
   Case Charcode of
     vk_left, vk_up, vk_right, vk_down : Result:=1;
   End;  
End;


Das ist schon mal ein guter Startpunkt um die weiteren Funktionen zu implementieren