Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form update of all connected sessions
#1
Hello

I have a use case when action in one form must refresh form components in all connected sessions. I can successfully update form components, but changes are not seen until web browser windows is refreshed (F5).

Executing WebApplication.ShowMessage properly pops up a message in all connected sessions.

Code:
procedure TFormMain.pRefreshForm;
begin
   WebApplication.ShowMessage('Session message'); // this message shown
   RegionMain.AjaxReRender();
end;


var LSessions : TList;
   LSession : TIWApplication;
   i : Integer;
begin
   LSessions := GSessions.LockList;
   try
       for i := 0 to Pred(LSessions.Count) do begin
           LSession := LSessions[i];
           LSession.Lock;
           try
               // to-do: check which form is opened

               TFormMain(LSession.ActiveForm).ImageUser.Picture.Url := 'xxx';
               TFormMain(LSession.ActiveForm).EditName.Text := 'User Name';
               TFormMain(LSession.ActiveForm).pRefreshForm; // message is shown, but form is not refreshed
               // TFormMain(LSession.ActiveForm).Update; // does not work
               // TFormMain(LSession.ActiveForm).Refresh; // does not work

           finally
               LSession.Unlock;
               // LSession.Redirect('http://127.0.0.1',True); // does not work
               LSession := nil;
           end;
       end;
   finally
       GSessions.UnLockList(LSessions);
   end;
end;

Please advise me if it is possible to execute refresh of all active forms bound to one web server.

ps: I am using IW 1.4 and cgdevtools components 14.2.

Regards,
Tomaž
Reply


Messages In This Thread
Form update of all connected sessions - by cyracks - 12-15-2018, 09:30 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)