How can I do this ? I tried disabling all application's TFORM descendants
except this MDI Child, but seemingly disabling the parent form disables the
child form as well.
The bottom line is this: I don't want the user be able to access the menu on
the main form, or any other open MDI childs, just the controls of this
"modal" MDI child. I can't use a normal modal form, because 1) it will not
be inside the boundaries of the Parent MDI, and 2) It moves behind the
parent MDI (of course it can be brought
in front, but it is a nuisance).
I need some advice in this. Thanks for your help.
Matti Mäki-Petäys
You can not have modal MDI Children. MDI is implemented in Windows
itself, and that was one of the rules that the MS engineers set forth.
> I tried disabling all application's TFORM descendants
> except this MDI Child, but seemingly disabling the parent form disables the
> child form as well.
Right. Any time a window is disabled, all of its children are also
disabled. If you think about it, that makes sense - disabling a window
isn't going to be very useful if the buttons on that window are still
usable.
> The bottom line is this: I don't want the user be able to access the menu on
> the main form, or any other open MDI childs, just the controls of this
> "modal" MDI child. I can't use a normal modal form, because 1) it will not
> be inside the boundaries of the Parent MDI, and 2) It moves behind the
> parent MDI (of course it can be brought
> in front, but it is a nuisance).
1) You can put the modal form where ever you like at run time. Just
tweak the Left and Top properties before calling ShowModal.
2) That should not happen. How are you creating the modal window?
Good luck.
Kurt
- Allen.
In article <6im9sn$sr...@forums.borland.com>, Matti.ma...@Iki.fi
says...
> I'd like some of my MDI childs to act like modal windows, so that the MDI
> form would be disabled until this child is closed.
>
> How can I do this ? I tried disabling all application's TFORM descendants
> except this MDI Child, but seemingly disabling the parent form disables the
> child form as well.
>
> The bottom line is this: I don't want the user be able to access the menu on
> the main form, or any other open MDI childs, just the controls of this
> "modal" MDI child. I can't use a normal modal form, because 1) it will not
> be inside the boundaries of the Parent MDI, and 2) It moves behind the
> parent MDI (of course it can be brought
> in front, but it is a nuisance).
>
uses ......;
var
ModalForm : TForm;
IsModalForm : Boolean;
type
TMainForm = class(TForm)
.......
procedure TMainForm.FormCreate(Sender: TObject);
begin
IsModalForm := False;
.....
end;
{Create the modal MDI-Child:}
procedure TMainForm.CreateMDIxxx(const Name: string);
var
Child: TFormMdiChild;
begin
{ create a new MDI child window }
Child := TFormMdiChild.Create(Application);
Child.Caption := Name;
ModalForm := Child;
end;
{Disable some controls in the mainform when Modal MDI-Child is active:}
procedure TMainForm.UpdateMenuItems(Sender: TObject);
begin
FileNewItem.Visible := (not IsModalForm);
FileOpenItem.Visible := (not IsModalForm);
....
SpeedButton1Enabled := (not IsModalForm);
end;
The Form FormMdiChild itself contains the following code:
procedure TFormMdiChild.FormCreate(Sender: TObject);
begin
IsModalForm := True; // variable from unit Main
.....
end;
procedure TFormMdiChild.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
.....
Action := caFree;
IsModalForm := False; // variable from unit Main
end;
procedure TFormMdiChild.FormDeactivate(Sender: TObject);
begin
ModalForm.Show;
end;
Hope this helps
Martin Sommerhalder
Som-Data-Service
<ma...@somdata.ch>
Kurt Barthelmess (TeamB) <71333...@compuserve.com> schrieb in Nachricht
<35512410...@forums.borland.com>...
>Matti -
>
>You can not have modal MDI Children. MDI is implemented in Windows
>itself, and that was one of the rules that the MS engineers set forth.
>
> > I tried disabling all application's TFORM descendants
> > except this MDI Child, but seemingly disabling the parent form disables
the
> > child form as well.
>
>Right. Any time a window is disabled, all of its children are also
>disabled. If you think about it, that makes sense - disabling a window
>isn't going to be very useful if the buttons on that window are still
>usable.
>
> > The bottom line is this: I don't want the user be able to access the
menu on
> > the main form, or any other open MDI childs, just the controls of this
> > "modal" MDI child. I can't use a normal modal form, because 1) it will
not
> > be inside the boundaries of the Parent MDI, and 2) It moves behind the
> > parent MDI (of course it can be brought
> > in front, but it is a nuisance).
>