lpaulo Posted February 12, 2013 Share Posted February 12, 2013 Hello! How (or better, WHERE) can I to declare a global variable "sessioned"? A global variable to be used in all forms/units and different for each session? I want to use it like USERNAME for my authentication engine. Each session have a diferent user, and this variable will be used in all forms (to test grants). Thanks for help. Luiz Link to comment Share on other sites More sharing options...
albertovesx Posted February 12, 2013 Share Posted February 12, 2013 You can declare them inside mainmodule type TUniMainModule = class(TUniGUIMainModule) procedure UniGUIMainModuleCreate(Sender: TObject); private { Private declarations } public { Public declarations } globalVariableForEachSession: String; end; Link to comment Share on other sites More sharing options...
lpaulo Posted February 12, 2013 Author Share Posted February 12, 2013 Hello! Sorry my ignorance, but I am doing something wrong. I declared the variable in MainModule: type TUniMainModule = class(TUniGUIMainModule) private { Private declarations } public gNome : String; { Public declarations } end;... And I am trying to use the variable in MainForm: uses uniGUIVars, MainModule;function MainForm: TMainForm;begin Result := TMainForm(UniMainModule.GetFormInstance(TMainForm));end;procedure TMainForm.UniButton1Click(Sender: TObject);begin gNome := UniEdit1.Text;end; I try to use: gNome := UniEdit1.Text; or MainModule.gNome := UniEdit1.Text; The error is the same: [DCC Error] Main.pas(40): E2003 Undeclared identifier: 'gNome' What I am doing wrong? thanks. Luiz Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted February 12, 2013 Administrators Share Posted February 12, 2013 UniMainModule.gNome := Link to comment Share on other sites More sharing options...
lpaulo Posted February 12, 2013 Author Share Posted February 12, 2013 Thanks!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now