Solved

MDI Question: how i create a LOGIN form in a MDI application?

Posted on 2004-09-25
6
332 Views
Last Modified: 2010-04-05
Hi folks,

I am trying to put a LOGIN form in my application, but i got a error message saying that the MDI is not active ("No MDI forms are currently active").

Do you know how can i implement that?

Best regards.
0
Comment
Question by:joelsilva
6 Comments
 
LVL 4

Expert Comment

by:Delphian
ID: 12156478
The simple solution is to made the form an SDI form.
So, change the form Style to fsNormal and show it
before load the main form of the application (need a
little change on the DPR of the project).
0
 
LVL 4

Expert Comment

by:Delphian
ID: 12156543
Ops, a typo!
Where you read "change on the DPR"
read "change on the DPR file".

[]s
0
 

Author Comment

by:joelsilva
ID: 12156907
Hello,
 
Thx. for reply... I will check your suggestion.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12158234
Here is my suggestion:

LOGIN FORM:
------------------------------------------------------------
  TfrmLogin = class(TForm)
  private
  public
    class function CheckLogin : Boolean;
  end;

  class function TfrmLogin : Boolean;
  begin
    // Check your login here
   
  end;
-----------------------------------------------------------

modify your DPR file like this:

begin
  Application.Initialize;
  if TfrmLogin.CheckLogin then
    begin
      // create your forms
      Application.CreateForm(TForm1, Form1);
    end;
  Application.Run;
end.
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12160892
if you wanted to use MDI forms and have the login window, the way to do it would be to create that MDI Child window dinamically with the login stuff at the OnShow event of the MainForm, from there you can "enable" all the other stuff if the login was successful, here's an example, supposing the Form1 is the Main Form and Form3 is the login Form

procedure TForm1.FormShow(Sender: TObject);
begin
  with TForm3.Create(nil) do
  try
    Show
  finally
    Free
  end
end;

you would have to disable all functions in your main window (buttons, menus, etc) until they login, from the login Form you would have to change a global variable that would inform the main form that is logged in so you can enable everything that needs to be enabled, you can even have a call to the main form from the MDI Child to do all these
0
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 25 total points
ID: 12160927
sorry... this is MDI Forms... all you need to do is this:

procedure TForm1.FormShow(Sender: TObject);
begin
  with TForm3.Create(nil) do //set any properties of the child window here... captions, edit boxes, buttons, etc
end;

the Show gets called automatically for MDI Child forms, and you don't need to free it, you can free it in the OnClose event of the Child form:

procedure TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:=caFree
end;
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Machine not responding during CopyFile() 3 103
Path  to current project in Delphi. 2 90
Delphi: Connect to running MS Outlook 4 117
Twebbrowser add css to the header 3 27
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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