stlcours Posted May 2, 2012 Posted May 2, 2012 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. Quote
Administrators Farshad Mohajeri Posted May 2, 2012 Administrators Posted May 2, 2012 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. Quote
ttamturk Posted May 5, 2012 Posted May 5, 2012 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? Quote
Administrators Farshad Mohajeri Posted May 6, 2012 Administrators Posted May 6, 2012 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. Quote
ttamturk Posted May 6, 2012 Posted May 6, 2012 Ok. I also use modal Login form for now. Thanks. 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.