I am attempting to convert a GUI application that I made in Delphi (actually, its Lazarus) to a library(DLL).
In the GUI application I used a OnDataChange event listener, but I cannot seem to figure out how to do the same thing for the library.
Here is what it looks like in the GUI App:
procedure TForm1.Datasource2DataChange(Sender: TObject; Field: TField);
begin
ZMakeRankedTable.Close;
GetNN;
end;
And in the unit’s LFM file:
object Datasource2: TDatasource
DataSet = ZMakeRankedTable
OnDataChange = Datasource2DataChange
left = 184
top = 95
end
How do I do the same thing for the library? Where do I initialize the event listener?
What is wrong with creating a new class of your own that will be the delegate, instead of a form:
And just be sure to create an instance of the class
etc…
In other words, instead of a form, use a class you wrote to handle the events of the various classes. Like in a form, each of the procedures should have the signature of the event handler. The only difference is that the IDE won’t create these methods for you.
You could also use a TDataModule, I guess, but I am not sure about the implications. The advantage would be IDE support.