Board index » delphi » Delphi: MessagesPending() function

Delphi: MessagesPending() function

Is there a function that says "are there messages pending"? By
messages I mean mouse clicks not yet processed or keystokes waiting in
the keyboard buffer.

This is why I ask. It would be useful here:

On scrolling a table, a look-up in OnDataChange() slows down the
display. This is an issue if the user keeps clicking repeatedly on the
scroll bar.

In other words, the lookup function is very much "in a hurry" to try
and catch up. This means the entire DBGrid drags along and feels
boringly slow.

If there was a function which could test whether there are "scroll
clicks" or any keystrokes or clicks not yet processed or pending, then
the lookup function could be called at the end only. This occurs when
the user releases the mouse and there are no more clicks pending.

The scrolling display would become lightning fast, despite a complex
lookup link to other tables.

Does anybody know if there is such a "messages pending" function in
the Windows API?

Email appreciated
Matthew

 

Re:Delphi: MessagesPending() function


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...

On Tue, 19 Nov 1996 01:55:29 GMT, Com...@lottery.powernet.co.uk

Quote
(Matthew) wrote:
>Is there a function that says "are there messages pending"? By
>messages I mean mouse clicks not yet processed or keystokes waiting in
>the keyboard buffer.

>This is why I ask. It would be useful here:

>On scrolling a table, a look-up in OnDataChange() slows down the
>display. This is an issue if the user keeps clicking repeatedly on the
>scroll bar.

>In other words, the lookup function is very much "in a hurry" to try
>and catch up. This means the entire DBGrid drags along and feels
>boringly slow.

>If there was a function which could test whether there are "scroll
>clicks" or any keystrokes or clicks not yet processed or pending, then
>the lookup function could be called at the end only. This occurs when
>the user releases the mouse and there are no more clicks pending.

>The scrolling display would become lightning fast, despite a complex
>lookup link to other tables.

>Does anybody know if there is such a "messages pending" function in
>the Windows API?

>Email appreciated
>Matthew

Re:Delphi: MessagesPending() function


: On Tue, 19 Nov 1996 01:55:29 GMT, Com...@lottery.powernet.co.uk

Quote
: (Matthew) wrote:

: >Is there a function that says "are there messages pending"? By
: >messages I mean mouse clicks not yet processed or keystokes waiting in
: >the keyboard buffer.
: >
: >This is why I ask. It would be useful here:
: >
: >On scrolling a table, a look-up in OnDataChange() slows down the
: >display. This is an issue if the user keeps clicking repeatedly on the
: >scroll bar.
: >
: >In other words, the lookup function is very much "in a hurry" to try
: >and catch up. This means the entire DBGrid drags along and feels
: >boringly slow.
: >
: >If there was a function which could test whether there are "scroll
: >clicks" or any keystrokes or clicks not yet processed or pending, then
: >the lookup function could be called at the end only. This occurs when
: >the user releases the mouse and there are no more clicks pending.
: >
: >The scrolling display would become lightning fast, despite a complex
: >lookup link to other tables.
: >

Another reader directed you toward PeekMessage, which is probably
the way to go.  However, you might also make sure you are using
the Scrollbar's "Change" event instead of "Click" event.  Change
only gets called at the end (when user releases mouse and the value
actually is changed).

procedure MyForm.ScrollBarTimeChange(Sender: TObject);
begin
     UpdateTableLookup();
end;

--
------------------------
-- David Kirkpatrick  --
-- Southwest Software --
-- dav...@csn.org     --

Other Threads