Use Showmodal to show form,But trouble...

  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!
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

EdHillmannConnect With a Mentor Commented:
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,
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.
SurmeAuthor Commented:
Thanks Zash:
  I know that,but i need the function like showmodal and enable min mainmenu.
SurmeAuthor Commented:
Thanks Edhillmann:
  Maybe you are right.

All Courses

From novice to tech pro — start learning today.