Jump to content

<TMainForm> already is being created .... react on string-change without timer...


erich.wanker

Recommended Posts

Hello folks,

 

 

 

 

in UniMainmodule - i have a public String called "LMessageStr"....

 

now i change in TUniGUISession A  the "LMessageStr"-content of TUniGUISession B

 

in TUniGUISession B  - the  TMainForm.timer1 checks the content of the public unimainmodule-String.... and starts things depending on the content of the public unimainmodule-String...

 

 

This Works .. but i have a delay: the timer intervall is 10 seconds... and a lot of communication between server and client just for the timer...

 

                                          ********************************************************

 

My TStringlist - test:

 

i thought i can use a TstringList and his event(onChange) instead of a UniTimer .. if i change the TStringList in Session B, the onChnageEvent will be fired and i can react on the change ... 

So i create a  TStringlist in unimainmodule and a selfmade event: onChange ... but when the onChange event tries to start a procedure on Main (i need this!)   - i get an Error:

 

vmo.dll: 00002CFC: 15:40:32 [An instance of <TMainForm> already is being created.-192.168.0.153]:Exception : An instance of <TMainForm> already is being created. : Addr: $01E67AE2

 

 

 

 

Any Ideas how i can solve this?

 

thanX

Erich

 

 

 

 

 

 

 

 

 

 

 

 

 

the declaration of the TSringList

unimainmodule - public:

   stringlist_message:TStringList;
   procedure HandleStringListMessageChange(Sender: TObject);
 

 


the create....

procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject);
begin
    stringlist_message:= TStringList.Create;
    stringlist_message.OnChange:=   HandleStringListMessageChange;
 
 

 


the event...

procedure TUniMainModule.HandleStringListMessageChange(Sender: TObject);
begin
LMessageStr:=stringlist_message.text;
//main.MainForm.LMessageAction;    <---- doesnt work !!!!!!!!!!!!!!!!!!!!
end;

 

 
how i change values from other sessions...

    begin
    // Suche Session und starte Suche
        ASessionList := UniServerModule.SessionManager.Sessions.SessionList; //  .SessionList.  ist;//  .LockList;
          try
            for I := 0 to ASessionList.Count -1 do
            begin
              USession := TUniGUISession(ASessionList[i]);
              M := USession.UniMainModule as TUniMainModule;
                 if UniApplication.UniSession.SessionID <> USession.SessionId  then   // Do not close my OWN Session
                 begin
                    if M.benutzernummer = handy_user_id then
                    begin
                      M.stringlist_message.Text :=handy_user_search;
                    end;
                 end;
             end;
          finally
             uniapplication.terminate;   // UniServerModule.SessionManager.Sessions.SessionList.UnlockList;
          end;
    end;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...