Technical Information Database TI1363D.txt Returning Default Cursor after Running Queries Category :General Programming Platform :All Product :Delphi All Description: Q: Why does the Mouse cursor not change back to an arrow after I do a Query? A: When performing an open on a query, Delphi will change the cursor for you, even in the middle of an event, such as a button click.The example below will cause the cursor to show as a SQL Hourglass Icon, after you close the showmessage dialog box. The Mouse will behave as if its in the arrow state. // Add to a button click event, the Query used does not // matter I used // Select * from Customer (on IBLocal) with query1 do begin close; open; showmessage(IntToStr(RecordCount)); end; // with What appears to be happening is that when Delphi tries to change the Cursor back to the Arrow, a new form has already been shown (the showmessage dialog) and so its job is done as the cursor will automaticly be set to the arrow on the showmessage dialog form. To solve this problem, add a Application.ProcessMessages before showing anew form, this will clear all pending message commands from the message queue, and the Mouse Cursor will appear normal again. // Add to a button click event, the Query used does // not matter I used // Select * from Customer (on IBLocal) with query1 do begin close; open; application.ProcessMessages; // Add This Line. showmessage(IntToStr(RecordCount)); end; // with Reference: 7/16/98 4:34:09 PM
Last Modified: 01-SEP-99