Solved

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

Posted on 2004-09-25
6
327 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
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…

776 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