Independent Forms of the Main Form

Hi...

Im creating a form independent of the main form. But when that form call 
another modal form, i want to that modal only "locks" the indepent form, and 
not the entire application.
I´ve tried to use PopupParent property, but didnt have effect or im using in 
the wrong way.

To do that im doing this:

// FORM 1: The main form
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2 := TForm2.Create(nil);
  Form2.Show;
end;


// FORM2: The independent form
type
  TForm2 = class(TForm)
    Button1: TButton;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure CreateParams(var Params: TCreateParams); override;
  public
    { Public declarations }
  end;

procedure TForm2.Button1Click(Sender: TObject);
begin
  try
    Form3 := TForm3.Create(Self);
    Form3.PopupParent := Self; // This has no effect
    Form3.ShowModal;
  finally
    Form3.Free;
  end;
end;

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  Params.WndParent := GetDesktopWindow;
end;

procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

// FORM 3: The modal form, that should "lock" only the Form2
type
  TForm3 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

procedure TForm3.Button1Click(Sender: TObject);
begin
  Close;
end;


How can i make this work?
Thanks!

I´m using Delphi 2007 with update 3 running on WinXP.
0
Marcos
6/25/2009 1:25:04 AM
embarcadero.delphi.general 4258 articles. 0 followers. Follow

1 Replies
1125 Views

Similar Articles

[PageSpeed] 56
Get it on Google Play
Get it on Apple App Store

"Marcos Flavio Lommez" <lommez@hotmail.com> wrote in message 
news:131392@forums.codegear.com...

> Im creating a form independent of the main form. But when that form
> call another modal form, i want to that modal only "locks" the indepent
> form, and not the entire application.

That is not how modal forms work.  You will have to use Show() instead of 
ShowModal(), and set the calling form's Enabled property to False until the 
shown form closes.

> I´ve tried to use PopupParent property, but didnt have effect or im
> using in the wrong way.

PopupParent does not affect modality.

-- 
Remy Lebeau (TeamB)
0
Remy
6/25/2009 8:45:07 AM
Reply:

Web resources about - Independent Forms of the Main Form - embarcadero.delphi.general

Independent - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...


Anderson Independent Mail: Local Anderson, South Carolina News Delivered Throughout the Day.
Current news for Anderson, SC and its surrounding communities brought to you by Anderson Independent Mail. Features local Anderson, South Carolina ...

Home - Newport, AR - Newport Independent - Newport, AR
Get the latest breaking news, sports, entertainment, obituaries - Newport Independent - Newport, AR

Irish Independent - Your News - Your Way - Your Say - Independent.ie
News, video, photos and commentary from your Irish Independent newspaper including Breaking, National, World, Sport and Business updates.

The Independent - News - UK and Worldwide News - Newspaper
The latest in UK News and World News from The Independent. Wide range of international and local news, sports news, commentary and opinion pieces. ...

Keller Independent School District - Wikipedia, the free encyclopedia
The Keller Independent School District is a K-12 public school district based in Keller , Texas ( USA ). It serves more than 31,000 students ...

Independent audit of public service finds APS is burdened by red tape and risk averse culture
An independent audit has found what many in the public service will already know.

Independent Metro Petroleum pressure puts Canberra on discounting cycle
&nbsp;Thrift drivers spread word on low-profile Fyshwick petrol discounter.

Ted Mack working to install an independent in Joe Hockey's old seat
... the defeat of another Liberal Party candidate in North Sydney. The former federal MP, who twice won the blue-ribbon Liberal seat as an independent, ...

Resources last updated: 11/21/2015 11:39:50 AM