Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
I use a opengl component based on tcustompanel. I should not have done that as i now am not able to read out the keyboard from that component. When pressing keys it take whatever component is available like the treecomponent or an edit box.
What should i use as a base for an opengl component?
Registriert: Mi Jul 17, 2002 12:07 Beiträge: 976 Wohnort: Tübingen
SoS gave me this tip:
Try
Code:
if GetAsnycKeyState(vk_space)<0 then...
When a key is pressed, GetAsnycKeyState will give you a value < 0
_________________ "Du musst ein Schwein sein in dieser Welt, sangen die Prinzen, das ist so 1.0. Du musst auf YouTube zeigen, dass dir dein Schweinsein gefällt, das ist leuchtendes, echtes Web 2.0." - Hal Faber Meine Homepage: http://laboda.delphigl.com
TCustomPanel is ok to contain an OpenGL window. Normally you would track the keyboard messages of the underlying form, since messages of controls with no input focus are sent to the parental object instead.
The problem is, that you use focussable controls in the same form - and Delphi thinks (quite correctly) that they should get the focus, if you input something.
A quick and dirty solution (don't tell anybody where you got this tip from ). is to "hide" a focussable control behind your panel and give it the focus any time you want the OpenGL panel to have it. Then you can track the messages of the TEdit (or whatever control you used).
A cleaner solution is to let the On(enter keyboard input message here) routines of all focussable controls point to the same procedure - and to decide at runtime, if the input is for the OpenGL window or for the active control (with this method you can use the cursor keys to steer your OpenGL scene and character keys to change the content of an edit window at the same time).
Yet another solution is to keep the OpenGL window and the input controls in different forms.
Mitglieder in diesem Forum: 0 Mitglieder und 14 Gäste
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.