I have a TStringGrid and want to compute and show one row after each other. Because this needs some time for > 1000 rows, I will show the HourGlass-Cursor until the last row is done.
But in my program this works only, if the mouse is over the StringGrid area at the moment, when I press the button (by TAB and ENTER). When I press the button with the mouse (so the mouse is not over the StringGrid area at this moment) I don't get the HourGlass-Cursor, even if I move the mouse now over the StringGrid area.
I'm working on Windows 7 32 bit.
Can please somebody tell me, what I do wrong?
I zipped and appended my example project, if someone wants to compile and start it.
procedure TForm1.Button1Click(Sender: TObject);
var n: integer;
begin
Stringgrid1.RowCount:=1; {1 row for the titles}
Stringgrid1.FixedCols:=0; {no fixed colums}
Stringgrid1.ColCount:=1; {have only 1 column}
Stringgrid1.Cells[0,0]:='Results';
Stringgrid1.Cursor:=crHourGlass; {want HourGlass-Cursor}
for n:=1 to 10 do
begin
Stringgrid1.RowCount:=n+1; {add 1 row}
sleep(300); {compute something...}
Stringgrid1.Cells[0,n]:='Hello' + intToStr(n);
StringGrid1.Refresh; {show the new line}
end;
StringGrid1.Cursor:=crDefault; {back to normal Cursor}
end;