Forum > GTK

Problem with keyboard and multithreading


In my application I create windows in second thread and hide it.

--- Code: ---  FWindow := TForm.CreateNew(Application);
  FWindow.Position := poScreenCenter;
  FWindow.Width := 1;
  FWindow.Height := 1;
  FWindow.BorderStyle := bsNone;
  FWindow.FormStyle := fsStayOnTop;
  FWindow.Color := 0;
--- End code ---
As usually thread is sleeping.

Then automatically create a normal form, nothing special. But event OnFormKeyDown take me a strange value of key. For some keys it 255. Also GetKeyState return same value.
When I turn off thread everything is fine.

Lazarus 0.9.29 FPC 2.4.2 via GTK2 Ubuntu 10.4 AMD64

Please help.

I try to replace FWindow.WindowProc to dummy procedure, but nothing is changes.

Find interesting article
but what to do, I do not know.
May be need tell GTK to do not tracking keyboard for this window, but how can I do this  :-\


[0] Message Index

Go to full version