Article View: borland.public.cppbuilder.nativeapi
Article #8838Re: MDI Form problem
From: Remy Lebeau (TeamB)
Date: Mon, 06 Sep 2004 20:00
Date: Mon, 06 Sep 2004 20:00
57 lines
2520 bytes
2520 bytes
"Eugene" <Eugene@nospam.com> wrote in message
news:413c7e50$1@newsgroups.borland.com...
> I have a login form which is Main Form in my project.
That is not a good design choice. Your MDI form should be your MainForm
instead.
> When user enters his/her info and click to a button, Login
> form closes and a main MDIForm opens up.
If you make your login form be the MainForm, the program will terminate when
the login form is closed.
> When i change FormStyle of MainForm to fsMDIForm
> and run application, MainForm appears.I don't want
> MainForm to open immediately
You probably have the form set to Auto-Create in the Project Options.
> i will make it show after loginform. How can i do this?
Don't make the Login form be the MainForm at all. The MDI form should be
the MainForm. Then modify the project's WinMain() function directly to
display the login form manually before the MainForm is created. If the
login form rejects the login, you can terminate the program without running
the MainForm at all. For example:
#include "LoginForm.h"
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
TLoginForm *login = new TLoginForm(Application);
int Result = login->ShowModal();
delete login;
if( Result == mrOk )
{
Application->CreateForm(__classid(TMDIForm), &MDIForm);
Application->Run();
}
}
catch(const Exception &E)
{
Application->HandleException(&E);
}
return 0;
}
Gambit
Technical Details
Message-ID:
<413cc174@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<413c7e50$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e9d454281d5e241b X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <413c7e50$1@newsgroups.borland.com> Subject: Re: MDI Form problem Date: Mon, 6 Sep 2004 13:00:24 -0700 Lines: 59 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <413cc174@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1094500724 68.69.17.41 (6 Sep 2004 12:58:44 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail