I have had a play with PeekMessage(). The function works, but the
catch is as follows.
I am scrolling a linked table. The "seek" in the link slows the
scolling down. So I only want to "seek" and locate the record pointer
in the other table when the user has STOPPED scrolling. While the user
is scolling, I don't want seeks. So I thought, if there are Messages
pending, with PeekMessage(), then don't seek, else do. Sounds simple,
but the trick is this.
I set the seek filter to WM_MOUSEFIRST/LAST. The user presses the
mouse down continuously on the scroll bar of a DBGrid. This results in
PeekMessage() returning false, which is not what we want. Only
continous and very fast Mouse up/mouse down/mouse up/mouse down action
would return true.
If I use 0 and 0 in the filter to catch ANY message, the result always
returns true. The reason, I think, is that any mouse click in my
display has some consequence, i.e. a PAINT message, so the PeekMessage
returns true at all times, so does not help.
What would be great would be if there was a OnMouseUp() handler which
works when the user releases the mouse on the DBGrid scroll bar.
Sadly, OnMouseUp() works only inside the DBGrid, not on its scrolls
bars. OnMouseUp() with TForm's KeyPreview:=true does not respond at
all, I have found.
One more thing I tested was polling with GetKeyState() for the Mouse
buttons. I thought while the mouse is DOWN do not update the "seek",
otherwise do. Unfortunately, by the time the mouse is UP, the
scrolling has finished. This is the way the Windows scroll bars seem
to work. So the seek never happens and the table record pointer is not
updated.
These issues all concern the scroll bars, everything else can be
handled with OnKeyUp() and OnMouseUp() elsewhere.
Real tricky...
Email appreciated
Matthew
Quote
>It sounds like that you are after the Win API function 'PeekMessage'.
>It returns True if a message is available, and False it not. It also
>has filter parameters so that you can specify that you only want Mouse
>and Keyboard messages. Hope this helps...