Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Apr : Example of TSync.SynchronizeMethod
| Subject: | Example of TSync.SynchronizeMethod |
| Posted by: | "Moore" (moo..@hotmail.com) |
| Date: | 9 Apr 2008 04:15:42 |
I need an example of TSync.SynchronizeMethod as I don't find one in Internet, Especially how to declare and implement the method needed as a parameter,
I need to access a data module's own comps and methods and I have the following code:
type
TSyncGUI = class(TIdSync)
protected
FListBox: TListBox;
FMsg: String;
procedure DoSynchronize; override;
public
constructor Create(AListBox: TListBox; AMsg: String);
class procedure AddMsg(AListBox: TListBox; AMsg: String);
end;
constructor TSyncGUI.Create(AListBox: TListBox; AMsg: String);
begin
FMsg := AMsg;
FListBox := AListBox;
inherited Create;
end;
procedure TSyncGUI.DoSynchronize;
begin
FListBox.Items.Add(FMsg); // Self.lstLog.Items.Add(FMsg) // //Self must point to the data module or form instance
if FListBox.ItemIndex = FListBox.Count - 2 then
FListBox.ItemIndex := FListBox.Count - 1;
end;
class procedure TSyncGUI.AddMsg(AListBox: TListBox; AMsg: String);
begin
with Create(AListBox, AMsg) do
try
Synchronize;
finally
Free;
end;
end;
I can refer to the Data module with its name but it is not valid in my situacion as I create various instances of this data module at runtime and I need to refer to it with Self, inside the Sync class Self refers to the Sync class not to the data module's instance..
thnx