Hello,

I am trying to implement all key events for the Qt widgetset. I used the code on win32 as a model, but a very simple thing doesn't work here.

Qt events are processed correctly and it enters the SlotKey procedure, because I can see the WriteLn, but the OnKeyUp event of the form is never executed. So I assume something is wrong inside my SlotKey procedure, but I don't know what.

Here is my event on the form:

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  WriteLn('KeyUp' + IntToStr(Key)); // I cannot see this
end;

Here is my Qt code:

{------------------------------------------------------------------------------
  Function: TQtWidget.SlotKey
  Params:  None
  Returns: Nothing

------------------------------------------------------------------------------}
procedure TQtWidget.SlotKey(Event: QEventH); cdecl;
var
  Msg: TLMKey;
  SecondMsg: TLMKey;
begin
  WriteLn('SlotKey'); // I can see this

  FillChar(Msg, SizeOf(Msg), #0);

  if QEvent_type(Event) = QEventKeyRelease then Msg.Msg := LM_KEYUP
  else Msg.Msg := LM_KEYDOWN;


{------------------------------------------------------------------------------
   Translates a Qt4 Key to a LCL VK_ key

------------------------------------------------------------------------------}
  Msg.CharCode := QtKeyToLCLKey(QKeyEvent_key(QKeyEventH(Event)));

  try
    LCLObject.WindowProc(TLMessage(Msg)); // Doesn't work???
  except
    Application.HandleException(nil);
  end;

//LM_KEYDOWN
//LM_KEYUP
// LM_CHAR
end;

by the way, LCLObject is the AWinControl from:
class function TQtWSCustomForm.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND;

thanks in advance,

Felipe

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to