Use Showmodal to show form,But trouble...

Hello:
  Now i use Showmodal to Show some forms,and then i can not control main form include minimizing.How can i do that?I need your help. thanks!
 
SurmeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZashCommented:
When in one application you use ShowModal to show a form, only that form is active. If you want to have access to any other form you gotta show your form with Show method.
0
SurmeAuthor Commented:
Thanks Zash:
  I know that,but i need the function like showmodal and enable min mainmenu.
0
EdHillmannCommented:
You'd have to do a bit more work than what the ShowModal gives you.  Zash is correct in that if you call your Dialog's ShowModal, the underlying forms can't process their messages (and in your case, can't be minimized).  You can't get at other forms in an app if one is modal.  That's the definition of Modal.

Zash is also correct in that you'd have to display the Dialog form with its Show Method.  But to get it to work the way I think you want, these are some other things you'll have to do:

1: Set the FormStyle of the Dialog form to fsStayOnTop.  This will keep the Dialog Form on top, even if it isn't active.

2: Put some code into your underlying form so that if it's clicked, it checks to see if the Dialog form is visible, and subsequently return focus to it if clikced outside.  This may be more complex, in that if you click on an Edit field on the undelrying form, the form's OnClick won't fire.  This bit may be better addressed by putting an event handler on the Screen.OnActiveFormChange event.  So anytime a form becaomes the active form, check if the Dialog form should get focus again.

3: Put code in the Dialog form to manually assign a value to the Dialog form's ShowModal property.

4: Change the code in the calling form to no use the value from the Dialog's ShowModal function.  It will need some kind of event which is triggered by the Dialog form when it closes.  This event handler will check the Dialog's ShowModal property.

Perhaps using a Modal form isn't the best solution, if you want to minimize the whole application while the form is open.  But, I think these are the things you'll have to change.

Hope this helps,
Ed
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SurmeAuthor Commented:
Thanks Edhillmann:
  Maybe you are right.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.