Article

From:
To:
Adalberto Baldini
Subject:
Re: SetFocus not working well
Newsgroup:
embarcadero.public.delphi.language.delphi.win32

Re: SetFocus not working well

Adalberto Baldini wrote:

> I modified project creating TLogin_Dld immediately after MainForm
> creation, so when mainfrm event is activate creation of Login_Dlg is
> done.
> 
> my project :
> begin
>   Application.Initialize;
>   Application.Title := 'Applicazione Gestionale ';
>   Application.MainFormOnTaskbar := True;
>   Application.CreateForm(TfrmMain, frmMain);
>   Application.CreateForm(TLogin_dlg, Login_dlg);

That is not what I was aiming at. You are still showing a form inside
the creation sequence of another form, so the problem is basically the
same as before. What you should do is something like this:

function LoginUser: boolean; var   LDlg : TLogin_dlg; begin   LDlg := TLogin_dlg.Create(nil);   try     Result := LDlg.ShowModal = mrOK;     // if the dialog does not do it store the user name or whatever data from the dialog you need     // somewhere the main form can retrieve it from.   finally     LDlg.Free   end; end;
  begin    Application.Title := 'Applicazione Gestionale ';    Application.MainFormOnTaskbar := True;    if not LoginUser then Exit;    Application.CreateForm(TfrmMain, frmMain);    Application.Run;   end.
-- Peter Below (TeamB) Don't be a vampire (http://slash7.com/pages/vampires), use the newsgroup archives : http://codenewsfast.com http://groups.google.com
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Sun, 30 Jun 2024 17:56:22 UTC
Copyright © 2009-2024
HREF Tools Corp.