soledue Posted April 23, 2012 Posted April 23, 2012 Is possible to know in one session what makes another? Quote
soledue Posted April 23, 2012 Author Posted April 23, 2012 with other words. I would like to see a variable in a session by another ??? Quote
leandroavila74 Posted April 23, 2012 Posted April 23, 2012 if you put this variable in the unit servermodule this is possible, and their sessions should update this variable. now I think I get a session variable by another is not possible. but Professor Farshad certainly has the final word. Quote
soledue Posted April 23, 2012 Author Posted April 23, 2012 would be nice if every session there is a variable such as tag where I can write in what form is so I can prevent access by other users if you put this variable in the unit servermodule this is possible, and their sessions should update this variable. now I think I get a session variable by another is not possible. but Professor Farshad certainly has the final word. Quote
Administrators Farshad Mohajeri Posted April 24, 2012 Administrators Posted April 24, 2012 Still not clear for me. How do you refer to other sessions? By Session Id? Do you keep a list of them? Do you want to share a global variable among all sessions? If yes put it in servermodule and protect it by Lock/Unlock Quote
soledue Posted April 24, 2012 Author Posted April 24, 2012 I'll explain, at every session I have a variable such as UserName I see that variable from another session without making it global. something like this for I:=0 to sessions.Count -1 do begin session.GetVariable['username']; end; Still not clear for me. How do you refer to other sessions? By Session Id? Do you keep a list of them? Do you want to share a global variable among all sessions? If yes put it in servermodule and protect it by Lock/Unlock Quote
Administrators Farshad Mohajeri Posted April 24, 2012 Administrators Posted April 24, 2012 In MainModule: TUniMainModule = class(TUniGUIMainModule) private { Private declarations } public { Public declarations } MyVar : Integer; end; In your code: implementation {$R *.dfm} uses uniGUIVars, MainModule, ServerModule, uniGUISessionManager; procedure TMainForm.UniButton1Click(Sender: TObject); var I: Integer; ASessionList: TList; begin ASessionList := UniServerModule.SessionManager.Sessions.SessionList.LockList; try for I := 0 to ASessionList.Count - 1 do begin (TUniGUISession(ASessionList[i]).UniMainModule as TUniMainModule).MyVar:=10; end; finally UniServerModule.SessionManager.Sessions.SessionList.UnlockList; end; end; Quote
soledue Posted April 24, 2012 Author Posted April 24, 2012 Wow thank you very much In MainModule: TUniMainModule = class(TUniGUIMainModule) private { Private declarations } public { Public declarations } MyVar : Integer; end; In your code: implementation {$R *.dfm} uses uniGUIVars, MainModule, ServerModule, uniGUISessionManager; procedure TMainForm.UniButton1Click(Sender: TObject); var I: Integer; ASessionList: TList; begin ASessionList := UniServerModule.SessionManager.Sessions.SessionList.LockList; try for I := 0 to ASessionList.Count - 1 do begin (TUniGUISession(ASessionList[i]).UniMainModule as TUniMainModule).MyVar:=10; end; finally UniServerModule.SessionManager.Sessions.SessionList.UnlockList; end; end; 1 Quote
Administrators Farshad Mohajeri Posted April 24, 2012 Administrators Posted April 24, 2012 Correction: for I := 0 to ASessionList.Count - 1 do begin if not TUniGUISession(ASessionList[i]).IsTerminated then (TUniGUISession(ASessionList[i]).UniMainModule as TUniMainModule).MyVar:=10; end; Quote
AlbertoVesx Posted August 11, 2012 Posted August 11, 2012 Correction: for I := 0 to ASessionList.Count - 1 do begin if not TUniGUISession(ASessionList[i]).IsTerminated then (TUniGUISession(ASessionList[i]).UniMainModule as TUniMainModule).MyVar:=10; end; Hi, information like this one will be available in documentation? This kind of information is very useful. thanks Quote
Administrators Farshad Mohajeri Posted August 16, 2012 Administrators Posted August 16, 2012 Hi, information like this one will be available in documentation? This kind of information is very useful. thanks Yes, will be. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.