making mdi child forms MODAL

making mdi child forms MODAL

--------------------------------------------------------------------------------
You can not show a MDIChild form as modal. their formStyle should be set
to fsNormal
I have solved this problem in the following way.

I have (I should have) an ancestor form in my project which is the
father of all other forms in the project. In the CreateParams method of this
form I set the FormStyle := fsMDIChild and Visible := true
I have another form as ancestor of all modal forms in the project which
is itself a descendant of the main ancestor form. In the create params of
that form I set FormStyle := fsNormal and Visible := false. Why I set
visible := false here, because when you use the ShowModal method to show a
form as modal your form must not be visible otherwise you will get the
exception "can not show as modal a visible form" something like that and
if you create the form in visible state and then hide it and show it as
modal, your modal forms will be flickering at creation time, especially on
slow machines
Now, it happens that in my project I open the same form as modal and
modless in some cases. The only way I could solve this problem was by using
a global variable (the only one in the whole project) which I use as a
condition in CreateParams method to set the FormStyle property as I want. If
you are facing this situation, inform me and I will provide you with more
details.

Hope this helps
Vahan

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值