Jump to content

Variable global value change


Alex B.

Recommended Posts

In my project, I have a login screen, where the user enters the login and password, I use this information to query the database. When the query returns a record, I assign the value of the record's ID to a variable I declared in my MainModule.

In my MainForm, I put a showmessage for me to check the value of the variable. the problem is that if I log in a user in a browser and then log in another user in another browser, when I try to display the ID of the first user who logged in, the second one appears.

How can I solve this problem? each user must display his corresponding ID in each browser.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

You should not declare a global variable, but a public variable in MainModule class

unit MainModule;

interface

uses
  uniGUIMainModule, SysUtils, Classes, uniGUIBaseClasses, uniGUIClasses;

type

  TUniMainModule = class(TUniGUIMainModule)
    UniNaImLtSistema: TUniNativeImageList;

    procedure UniGUIMainModuleSessionTimeout(ASession: TObject;
      var ExtendTimeOut: Integer);
    procedure UniGUIMainModuleCreate(Sender: TObject);
    procedure UniGUIMainModuleBrowserClose(Sender: TObject);
    procedure UniGUIMainModuleDestroy(Sender: TObject);


  private
  public
    vGlobalVariable: string;

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...