Solved

i want to show a login frame before the main form

Posted on 2004-04-30
7
142 Views
Last Modified: 2010-04-05
hello
i need to show a frame on starting the prog  before the main form
to get the username and the password and if correct it show the other form and close the first
sure also get data from the first to the second.
thx
0
Comment
Question by:mis82
  • 2
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 250 total points
ID: 10960230

   create frmLogin like the example below
   ---------------------------------------------------------------------------

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TfrmLogin = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
    class procedure GetLoginInfo (var Username, password : String);
  end;

var
  frmLogin: TfrmLogin;

implementation

{$R *.DFM}

{ TfrmLogin }

class procedure TfrmLogin.GetLoginInfo(var Username, password: String);
var
  tmp_form : TfrmLogin;
begin
  tmp_Form := TfrmLogin.Create(Application);
  with tmp_Form do
    begin
      if ShowModal = mrOK then
        begin
          UserName := Edit1.Text;
          Password := Edit2.text;
        end;
    end;
end;

end.


   and MainForm as shown :
   ------------------------------------------------------------
   unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    u, p : String;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

uses Unit2;

procedure TForm1.FormCreate(Sender: TObject);
begin
  TfrmLogin.GetLoginInfo(u, p);
end;

end.
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 10961091
.. or call in from the project source file, just before the Application.Exeucte()
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10967162

  andrewjb, you mean Application.Run :))
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 10984973
Knew it was something like that :-)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now