Solved

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

Posted on 2004-09-25
6
310 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
Comment Utility
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
Comment Utility
Ops, a typo!
Where you read "change on the DPR"
read "change on the DPR file".

[]s
0
 

Author Comment

by:joelsilva
Comment Utility
Hello,
 
Thx. for reply... I will check your suggestion.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 12

Expert Comment

by:Ivanov_G
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

12 Experts available now in Live!

Get 1:1 Help Now