Jump to content

Someone can give me a LoginDemo


stlcours
 Share

Recommended Posts

Now I just use this code, only work in Web:

procedure TMainForm.UniFormShow(Sender: TObject); 
begin 
 if WebMode then 
       if not AFlag then  
   begin 
       Hide; 
       AFlag:=True; 
       LoginForm.Show; 
   end; 
end;


procedure TLoginForm.UniFormClose(Sender: TObject; var Action: TCloseAction); 
begin 
 MainForm.Show; 
end;

 

Someone can give me a LoginDemo work both in VCL and Web? Because unigui est special whose MainForm must firstly be shown. Could Farshad Mohajeri add a new demo in your project? Thanks in advance!

And I should use which component to create a loginForm with a verification code in picture? Thanks again.

Link to comment
Share on other sites

  • Administrators

unit Main;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics,
 Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
 uniGUIClasses, uniGUIForm;

type
 TMainForm = class(TUniForm)
procedure UniFormShow(Sender: TObject);
 private
{ Private declarations }
 public
{ Public declarations }
LoginDone : Boolean;
 end;

function MainForm: TMainForm;

implementation

{$R *.dfm}

uses
 uniGUIVars, MainModule, uniGUIApplication, Unit1;

function MainForm: TMainForm;
begin
 Result := TMainForm(UniMainModule.GetFormInstance(TMainForm));
end;

procedure TMainForm.UniFormShow(Sender: TObject);
begin
 if not LoginDone then
 begin
if WebMode then Hide;
UniForm1.ShowModal;
 end;
end;

initialization
 RegisterMainFormClass(TMainForm);

end.

 

 

unit Unit1;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics,
 Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
 uniGUIClasses, uniGUIForm;

type
 TUniForm1 = class(TUniForm)
procedure UniFormClose(Sender: TObject; var Action: TCloseAction);
 private
{ Private declarations }
 public
{ Public declarations }
 end;

function UniForm1: TUniForm1;

implementation

{$R *.dfm}

uses
 MainModule, uniGUIApplication, Main;

function UniForm1: TUniForm1;
begin
 Result := TUniForm1(UniMainModule.GetFormInstance(TUniForm1));
end;

procedure TUniForm1.UniFormClose(Sender: TObject; var Action: TCloseAction);
begin
   MainForm.LoginDone:=True;
 if webmode then
MainForm.Show;
end;

end.

Link to comment
Share on other sites

Hi Farshad,

 

It's working for MainFormDisplaymode = mfWindow. I tried when mfPage, It is not working that way.

 

Any suggestion?

 

 

Plus: In this method It's loading main page with Login form.. This cause longer page loading time.

Is It possible first load small login page, and than create main form?

Link to comment
Share on other sites

  • Administrators

Hi Farshad,

 

It's working for MainFormDisplaymode = mfWindow. I tried when mfPage, It is not working that way.

 

Any suggestion?

 

 

Plus: In this method It's loading main page with Login form.. This cause longer page loading time.

Is It possible first load small login page, and than create main form?

 

There is no way to achieve this in page mode. My preferred way of login is displaying a modal login form in front of main form but I know this approach doesn't work for all. I need to redesign framework to allow login form become the main form.

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.

 Share

×
×
  • Create New...