View Full Version : user defined mouse event handler wanted!
atozix
25-10-2003, 06:55 PM
Hi all,, :?:
I was going to send you a private message M109uk , but decided that there may be others out here that would also appreciate this info..
You posted an excellent keyboard event handler to my other query, maybe you will respond here :)
It would be very handy to have a user defined mouse event handler ,
(for Delphi 5).......
allllllll righteeeeeeee then .. ato
atozix
26-10-2003, 07:54 AM
A bit more...
If one uses a normal form mousedown procedure for mouse events,
and then enters a repeat or while loop.. Whilst within the loop any mousedown action does not register...
How can you register a mouse down event whilst within such a loop...
eg...
--------------------------------------------
enter this procedure loop with a form mouse down action
procedure
repeat
do something
check for left mouse button
// how ??as form mousedown action does not register...!!
until leftmouse button
exit procedure
-------------------------------------------------
its a pretty simple task but implementing it is not obvious ....
I have tried setting Globals from the form mouse down , but these globals do not update whilst within the looping procedure ...
cheeeeeerrrrsssssssss ato
Harry Hunt
26-10-2003, 07:56 AM
Use DirectInput
atozix
26-10-2003, 09:50 PM
HI Harry...:)
hmmmmm, yes well I can solve the problem using DXInput,,,
OK... I now know that DirectInput is part of the ExcessGameDev kit :)
So, I will finally install it and try it out.... as I have got most of DelphiX under my belt........
Though for interest,,, Surely there is method to implement this in standard Delphi 5.. as well!!!!!
Its a pretty common type of situation ..
Remember I am a novice at Delphi programming....
Little by little, progress is made...
Cheeeeeeerrrrrrrssssssss ato
cairnswm
27-10-2003, 05:07 AM
The key is not to lock the program in a loop like that. Especially in a game as the screen rendering will be locked out of the loop as well.
Take a look at TheLion's templates in the tutorial section on how to use the OnIdle to do your refreshes.
If you move the loop counter into a global/form variable then you can use the same loop type structure within the OnIdle event handler without impacting the normal Windows events.
atozix
27-10-2003, 07:40 PM
Hi William... :)
THX for the response...
But for my particular situation, I have found the simple solution..
All One has to do is use
Application.ProcessMessages; // within the loop
(I knew it had to be easy !!).
============================
"The key is not to lock the program in a loop like that. Especially in a game as the screen rendering will be locked out of the loop as well. "
In my case, I am updating the screen within the loop..
----------------------------------
"Take a look at TheLion's templates in the tutorial section on how to use the OnIdle to do your refreshes. "
I don't have The lions templates , but I do have info on the OnIdle ..:)
-------------------------------
cheeeeeeeeeerrrrrrrssssssssss..................ato
atozix
04-11-2003, 04:12 AM
Hi Alll.... :)
Just thought I'd let the other novices know that one can get left and right mouse button info,, using the same functions that are listed in
Pause/ resume and fonts ( this forum)...
kindly supplied by M109UK
All you need to do is use
If IsKeyDown(VK_LBUTTON) Then // do somethiong
or If IsKeyDown(VK_RBUTTON)
the VK codes are very handy.... 8)
so that's the end of that..
cheeeeeeeeerrrrrrrrrrrrssssssssss ato
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.