Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic hourglass?

Status
Not open for further replies.

abbath8

Programmer
Sep 20, 2003
40
0
0
HU
Hi,

I use dbexpress and I wonder if it is possible to auto change the cursor to hourglass when there is some database activity (like table/query open, insert, update etc.).

The TSQLConnection has a SQLHourglass property, but it is only for:
Establishing a connection to the database server.
Fetching metadata from the database server.
Executing a statement using the Execute method.

So I don't want to set the cursor by code before every dataset open, execsql etc.

Is it a trick to solve this problem?
 
If you run your queries in their own threads, they shouldn't generate an hourglass...

...Or you can override the TSQLQuery class and previent the hourglass from showing.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is always another way to solve it, but I prefer my way.
 
Hey there
Don't have deplhi help nearby, but as far as i remember there is an array of cursors, something like Screen.Cursors.
You can change Screen.Cursors[SQLCursor] (for more details take a look at the helps) to any cursor you need.

HTH
--- McMerfy
 
here's the code to change the cursor to an hourglass during a process:

Code:
procedure TfrmMain.ReleasePanel1Click(Sender: TObject);
var
Save_Cursor : TCursor;
begin
  Save_Cursor := Screen.Cursor;
  Screen.Cursor := crHourGlass;
  try
    with qryYourQuery do
    begin
      SQL.Clear;
      SQL.Add('SELECT * FROM YOURTABLE');
      Active := True;
      //other processes here
    end;
    Active := false;
  finally
    Screen.Cursor := Save_Cursor;  { Always restore to normal }
  end;
end;

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
Ok guys, thanks for the posts. I know this solution. My question was if there is some trick to auto change the cursor during some database activity, so I don't want to write code before and after dataset opens, execsqls etc...
 
Yep, there is a way...

Creae a new class derived from TSQLQuery (or TQuery).
Then override some procedures to force a new cursor.

Some examples of procedures to override might be Open, Close, ExecSQL.

I haven't Delphi nearby at the moment, but I think all of the above procedures fires a common procedure you can override....

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is always another way to solve it, but I prefer my way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top