Page 1 of 1

Refresh multiple client instances

PostPosted: 05 Apr 2019 15:05
by FredT
Hi,

In a test project, I have a form with only checkboxes. I launch the server and several clients.

I would like that when I check a box in a client, it update the check box on all other clients, but I did not understand how to do it!

I can initialize checkbox values ​​only when I create a new client instance, but not update checkbox values on existing instances.

Code: Select all
procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
    MyChecked := IWServerController.GetChecked;

    IWCheckBox1.Checked := MyChecked.Checked_1;
    IWCheckBox2.Checked := MyChecked.Checked_2;
    IWCheckBox3.Checked := MyChecked.Checked_3;
    IWCheckBox4.Checked := MyChecked.Checked_4;
    IWCheckBox5.Checked := MyChecked.Checked_5;
end;

procedure TIWForm1.IWCheckBoxAsyncChange(Sender: TObject; EventParams: TStringList);
begin
    MyChecked.Checked_1 := IWCheckBox1.Checked;
    MyChecked.Checked_2 := IWCheckBox2.Checked;
    MyChecked.Checked_3 := IWCheckBox3.Checked;
    MyChecked.Checked_4 := IWCheckBox4.Checked;
    MyChecked.Checked_5 := IWCheckBox5.Checked;

    IWServerController.SetChecked(MyChecked);
end;


Thank.

Re: Refresh multiple client instances

PostPosted: 05 Apr 2019 16:04
by Alexander Bulei
Hi FredT,

I would like that when I check a box in a client, it update the check box on all other clients


You need use IWTimer (e.g: timeout: 300), and call the code to update the checkboxes.

You can use the global vars or db.

Best Regards.

Re: Refresh multiple client instances

PostPosted: 06 Apr 2019 21:28
by zsleo
I think IWMonitor is better than IWTimer for this situation.

It does require more coding....

Re: Refresh multiple client instances

PostPosted: 09 Apr 2019 10:45
by FredT
Hi Alexander,

Thank you for all.