Delphi component assigns event on the fly

I have ADOStoredProc in my form. This is not visual, but in code. Usually it is quite easy to handle the event if the component is visual. It is simply a matter of double-clicking on the desired event. But how to do it with code. I declared the procedure:

 procedure SP_SearchAfterScroll(DataSet:TDataSet)

Now, how to assign the AfterScroll event handler property to the SP_Search object (this is ADOStoredProc) for the procedure described above. I'm sure you will answer that. So thanks in advance.

+3
source share
1 answer

When SP_Search is TAdoStoredProc and has the OnAfterScroll property, all you have to do is:

SP_Search.OnAfterScroll := SP_SearchAfterScroll;

, SP_SearchAfterScroll. OnAfterScroll , :

TScrollEvent = procedure(DataSet: TDataSet) of object;

OnAfterScroll , , , SP_SearchAfterScroll .

Edit

SP_Search.AfterScroll := SP_SearchAfterScroll(SPSearch)' , TNotifyEvent . SP_Search.AfterScroll := SP_SearchAfterScroll, . ?

, Mikey , () :

SP_Search.AfterScroll := - SP_SearchAfterScroll " ", , . , - , . , , , , . , , , .

+11

All Articles