Solved

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

Posted on 2004-09-25
6
337 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

761 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