Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2000-10

QT - mouse and keyboard simult.

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Hankovec

Hello,
I try put the question once again :-)))

Please, does anybody know, how to use keyboard and mouse under win32 console window simultaneously ? If I test api mouse function, it works (taking it from FPC examples). The example with keyboard works too. But both wait for an event and then writes it's parameters. How can I "in one loop" test keyboard, mouse and do anything else ? While using API mouse, the CRT "readkey" and "keypressed" are not working at all :-( (or are working very bad).

Thanks for advice

Have a good day

Martin

Florian Klaempfl
to Martin Hankovec
Martin Hankovec wrote 13 lines
Hello, I try put the question once again :-))) Please, does anybody know, how to use keyboard and mouse under win32 console window simultaneously ? If I test api mouse function, it works (taking it from FPC examples). The example with keyboard works too. But both wait for an event and then writes it's parameters. How can I "in one loop" test keyboard, mouse and do anything else ? While using API mouse, the CRT "readkey" and "keypressed" are not working at all :-( (or are working very bad). Thanks for advice

Either you use the API units completly or you write your own mouse/keyboard routines. Then the only (good) solution (afaik) do this is to run a seperate thread which waits for an event and write it to buffers which can be read from the main program (the API uses more or less the same solution).

Martin Hankovec
Either you use the API units completly or you write your own mouse/keyboard routines. Then the only (good) solution (afaik) do this is to run a seperate thread which waits for an event and write it to buffers which can be read from the main program (the API uses more or less the same solution).

Well, I'd like to use API units. But I cannot start running keyboard and mouse simultaneously. If I test
...
uses Mouse, Keyboard ...
......
and in the program use GetMouseEvent etc., it looks like this function "steals" the events for keyboard. If anybody have a minute to show fragment of source, which gets coordinates and status of mouse and read keyboard in one loop, I'd be VERY glad :-)))

I took from source of API functions (I mean event.pas, mouse.inc and keyboard.inc) some fragments, which are working alone, but after some hours of testing I have no idea how to connect them into one working block :-(

Maybe there is (or will be) someone, who could need it too. I very appreciate anyone help.

Have a good day

Martin

Florian Klaempfl
to Martin Hankovec
Martin Hankovec wrote 19 lines
>Either you use the API units completly or you write your own mouse/keyboard >routines. Then the only (good) solution (afaik) do this is to run a seperate >thread which waits for an event and write it to buffers which can be read >from the main program (the API uses more or less the same solution). Well, I'd like to use API units. But I cannot start running keyboard and mouse simultaneously. If I test ... uses Mouse, Keyboard ... ...... and in the program use GetMouseEvent etc., it looks like this function "steals" the events for keyboard. If anybody have a minute to show fragment of source, which gets coordinates and status of mouse and read keyboard in one loop, I'd be VERY glad :-))) I took from source of API functions (I mean event.pas, mouse.inc and keyboard.inc) some fragments, which are working alone, but after some hours of testing I have no idea how to connect them into one working block :-(

I've send the drivers unit of FV in a seperate email.

Unknown author
to Martin Hankovec: Well, I'd like to use API units. But I cannot start running keyboard and mouse…

Date sent: Fri, 06 Oct 2000 11:02:36 +0200
From: "Martin Hankovec"
To:
Subject: Re: [fpc-pascal]QT - mouse and keyboard simult. Send reply to:

Well, I'd like to use API units. But I cannot start running keyboard and mouse simultaneously. If I test ... uses Mouse, Keyboard ... ...... and in the program use GetMouseEvent etc., it looks like this

You have to use PollMouseEvent and PollKeyEvent first to find out what's available, and only then either GetMouseEvent, or GetKeyEvent!

Have a nice day

Tomas Hajny, on Internet
in urgent cases