Autor Beitrag
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mi 27.06.07 20:39 
Hallo zusammen!

ich habe folgendes Problem: Ich schreibe an einer nicht visuellen Komponente, die irgendwie mitkriegen muss, wenn in dem ansonsten leeren Formular Tasten gedrückt werden.
An die meisten Tasten komme ich ja, indem ich OnKeyDown/OnKeyUp "umbiege" (meinen Eventhandler reinschreiben und den alten bei Bedarf aufrufen), nur für Tab funktioniert das ja leider nicht.
Normalerweise würde man jetzt die Message CMDialogKey abfangen, aber da komme ich so von der Komponente aus nicht ran.

Eine mögliche Lösung wäre jetzt, das Formular von einem eigenen TForm-Nachfolger abzuleiten, der für diese Message ein Event bereitstellt. Aber solche Codeänderungen wollte ich eigentlich vermeiden.
Gibts da irgendeine Lösung?

Ein Crosspost

mfg jakobwenzel

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
jakobwenzel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mi 11.07.07 21:13 
*push*

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Mi 11.07.07 23:05 
Hilft da vllcht die Eigenschaft KeyPreview der Form?

_________________
Programmers never die, they just GOSUB without RETURN
jakobwenzel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 12.07.07 11:27 
Leider nicht, denn auf der Form liegt keine visuelle Kompo, die die Tastaturereignisse für sich beanspruchen könnte.
Das Problem ist ja, dass Tab nie bei den KeyDown/-Up-Events ankommt, weil es vorher abgefangen wird.
Deshalb ist IMHO der einzige Weg, sich die Message CMDialogKey zu schnappen.
Das Problem ist halt, dass ich keinen Plan hab, wie man da ohne Änderungen am Code der Form von einer Komponente aus rankommt.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
jakobwenzel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Sa 11.08.07 12:25 
In der DP kam die Lösung, man kann über Form.WindowProc die WindowProcedure umbiegen und da die Messages abfangen.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.