Recent

Author Topic: Problem with keyboard and multithreading  (Read 6430 times)

YarUnderoaker

  • New Member
  • *
  • Posts: 32
Problem with keyboard and multithreading
« on: January 29, 2011, 12:03:32 am »
In my application I create windows in second thread and hide it.
Code: [Select]
 FWindow := TForm.CreateNew(Application);
  FWindow.Hide;
  FWindow.Position := poScreenCenter;
  FWindow.Width := 1;
  FWindow.Height := 1;
  FWindow.BorderStyle := bsNone;
  FWindow.FormStyle := fsStayOnTop;
  FWindow.Color := 0;
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.
« Last Edit: January 29, 2011, 10:49:47 am by YarUnderoaker »

YarUnderoaker

  • New Member
  • *
  • Posts: 32
Re: Problem with keyboard and multithreading
« Reply #1 on: January 29, 2011, 10:51:41 am »
I try to replace FWindow.WindowProc to dummy procedure, but nothing is changes.

YarUnderoaker

  • New Member
  • *
  • Posts: 32
Re: Problem with keyboard and multithreading
« Reply #2 on: January 29, 2011, 04:33:28 pm »
Find interesting article http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/gtk-thread-awareness.html
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  :-\

 

TinyPortal © 2005-2018