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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnScroll event, not quite right!

Status
Not open for further replies.

lespaul

Programmer
Joined
Feb 4, 2002
Messages
7,083
Location
US
I have several DBGrids, for each one I have created a procedure that should occur when the selected record is changed. So if the user doubleclicks the row, all this other stuff happens. I would also like to perform these actions if the user single clicks or scrolls through the dataset. I have tried:

procedure TDataMod.qryChargesAfterScroll(DataSet: TDataSet);
begin
Form_CaseInformation.DBGrid_ChargesDblClick(self);
end;

but it doesn't ever show the results.

Any suggestions?

Thanks,
Leslie


Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
AfterScroll doesn't work? It looks like it should. Try putting a break-point in there and see if you hit it; the problem may be down the chain a bit.

BTW: don't use 'self' as the parameter to the call; it might confuse the code event handler.

I use a separate method that the event handler calls except for the most trivial UI actions:
Code:
procedure TForm1.DBGridMouseDown(...);
begin
   AffectCurrentRow;
end;

procedure TForm1.AffectCurrentRow;
begin
...
end;
One advantage is that event handlers with different parameters can all call the same method. You can also call this method (safely) from outside the form because it is part of the TForm class (e.g. public), not part of the event handler/callback stuff.

Cheers
 
...try sticking Application.processmessages; in the event aswell to make sure all windows messages in the stack get executed.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top