Hello again,

here is a question for a windows devel. I understand that functions 
KeysToShiftState
and MsgKeyDataToShiftState exist for VCL compatibility and changing them might
affect existing programs (e.g. when the function is misused to read the keyboard
state).

I implemented some mouse event handling for the qt interface. Patches are 
attached.
The patched forms, lcltype and lclintf are only a draft for you to check if 
this code doesn't break
anything.

And now my question:
If a function is named 'KeysToShiftState' with a param 'Keys', I find it weird 
that for
some keys, the param is ignored. A real problem arises for the ALT key handling 
in
MsgKeyDataToShiftState. Because the ALT key is hard coded, I cannot make it work
without introducing duplicated code in the qt interface... So, would it be 
possible to
move the GetKeyState calls to the place were the LCL message is constructed 
(win32callback.inc)? 

something like:
        if GetKeyState(VK_MENU) then Msg.Keys:=Msg.Keys or MK_ALT;
and:
        if GetKeyState(VK_SHIFT)   < 0 then Msg.KeyData:=Msg.KeyData or 
MK_SHIFT;
        if GetKeyState(VK_CONTROL) < 0 then Msg.KeyData:=Msg.KeyData or 
MK_CONTROL;
        if KeyData and $20000000 <> 0 then Msg.KeyData:=Msg.KeyData or MK_ALT;

The two functions KeysToShiftState and MsgKeyDataToShiftState have now a 
very close resemblance allowing to merge the code.


kind regards,

Jan

pm: I'll be away for two weeks soon, so don't take it personaly if I don't 
reply :-)

Attachment: eventhandling.tar.gz
Description: application/tgz

Reply via email to