Re: Modal Forms and the Menu

Author: Matthew L. Brazier

Posted: 1998-07-10 at 15:45:38

<I><FONT COLOR="#663300">I think modal forms should not generally be used for data entry of records. However, there are times when you may want a form to be modal and allow record entry. What I do in this situation is use the ebizobjform with WidowType set to modal. Although this does not enable the File menu options, it does give me my toolbar and ALL the methods to process the records (I don't have to add any special code!)

Hi Matthew -

I suppose for the most part you are correct, that most of the time when you have a modal form, you don't want to allow data entry. In fact, in examining what I am trying to do, I guess you could say that I am compensating for a different problem by wanting to do DE from my modal form.... This modal form is a child form (ebizchildform). It actually could/should be non-modal, but the problem is I can't figure out how to keep it in synch w/the parent form, so I solved this by making it modal. So, does anyone know how to make my child form show the proper information as the user pages thru the records in the parent form? Is there native CB methods that automatically take care of this, or do I need to write my own?

Thanks!

ellen

</FONT></I>

Ellen,

Hello again. I have finally got back to re-thinking what I am doing in this situation and have come up with a good solution (at least for my situation) and I wanted to share it with you (well, share with all).

1) I have changed my sub-classed eBizObjForm form back to non-modal and have added a property myproperty_lFakeModalForm which I set to .T. in those forms that I want to be 'modal' but still behave as a data entry form.

2) I have added a property myproperty_lFakeModalMode to my aApp class.

3) I have created a sub-class of cbar which has the cSkipFor property set to goApp.myproperty_lFakeModalMode. This new class is used for menu option that should be dimmed when the 'Fake Modal' form is active.

4) In activate of my sub-classed eBizObjForm I have coded:

goApp.myproperty_lFakeModalMode = this.myproperty_lFakeModalForm

In deactivate I have coded:

goApp.myproperty_lFakeModalMode = .F.

This works wonderful. I now have a 'modal' form with a functional toolbar as well as working menu options!

I don't know about the keeping of multiple forms in synch as I don't do this. I always create forms with all the necessary parent and child bizobj's needed in the same form. Now, I do have forms that have multiple bizobj's where one bizobj may be allowed to save/delete/new, and another may only allow new, and then another that may only allow navigation. I accomplish this through properties in my bizobj which update the form's lAllowNew, lAllowDelete, and lAllowSave properties. Let me know if I need to post that information.

This still may not be what you want, but maybe it will give you some other ideas.

Hope this helped.

Matthew L. Brazier

Developing in VFP 5/6/7, Visual Studio 6

website: www.braziercomputerconsulting.com

email: mbrazier@braziercomputerconsulting.com

©1998 Matthew L. Brazier