Hi -
I have a modal form in SAVI/CB5, and I'm having problems with the menu File option - all the options under File are disabled. This should not be the case since even tho it's modal, the user can still add/delete etc. Is this a CB problem, or something I've created?
And an even bigger question.... WHERE do I go to fix it? (I know it's not in the skip for - skip for is working properly - I THINK it's disabling it at the PAD level for all the children and not looking at the individual BARs).
TIA!!
ellen
<I>
I have a modal form in SAVI/CB5, and I'm having problems with the menu File option - all the options under File are disabled. This should not be the case since even tho it's modal, the user can still add/delete etc. Is this a CB problem, or something I've created?
And an even bigger question.... WHERE do I go to fix it? (I know it's not in the skip for - skip for is working properly - I THINK it's disabling it at the PAD level for all the children and not looking at the individual BARs).
TIA!!
</I>
Hi Ellen:
I have dinked with this thing for a while now, but I was never able to get the File|New and associated buttons to enable with a modal form. However, in the venue of "One click is better than two" I did get a toolbar to work successfully.
To do this, in the subclass of the modal form you are using, place "cNavToolbar" in the form's .cToolbar property. This associates a toolbar with your form. It comes up when the form instantiates ... see CBaseForm::Init() for the code that makes this happen.
In the Init() of your modal form make a call to the superclass Init, like so, (assuming you are using cBaseModalForm in cForms.VCX as a superclass that is).
LOCAL llRetVal
llRetVal = CBaseModalForm::Init()
IF llRetVal
IF .NOT. EMPTY( THIS.cToolbar )
THIS.oToolbar.SetEnabled( .T. )
ENDIF
ENDIF
The reason for this is that CBaseModalForm, in the Init() disables all toolbars, including the one that you identified in .cToolbar property. The above code re-enables it again.
You now have a toolbar whose buttons the user can press to navigate, add new, save, cancel, etc.
Phase Two is to make your modal form talk to the toolbar. You must add First(), Next(), Last(), Prior(), New(), Save(), Cancel(), etc. to the form. In each of these methods your must pass the message along to the form's oBizObj(). You now have a Modal form that allows a user to perform CRUD activities.
Notice that you may not want the user navigating using the FPNL buttons. In this case, do not use cNavToolbar, create your own that only contains the cmdNew, cmdCancel, cmdSave and cmdExit button containd in cToolbar.VCX
This is the hard way.
The easy way is to add command buttons onto the form that call the business object's New, Cancel, Save and Delete methods.
Hope this helps. I have used both methods to get around the fact that the File menu bars are not enabled when a modal form is active.
Best,
CT
Flash Creative Management, Inc. (FLASH)
ctb@flashcreative.com
tomandanna@erols.com
Hi -
I have a modal form in SAVI/CB5, and I'm having problems with the menu File option - all the options under File are disabled. This should not be the case since even tho it's modal, the user can still add/delete etc. Is this a CB problem, or something I've created?
And an even bigger question.... WHERE do I go to fix it? (I know it's not in the skip for - skip for is working properly - I THINK it's disabling it at the PAD level for all the children and not looking at the individual BARs).
TIA!!
ellen
Ellen,
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!)
Matthew L. Brazier
Developing in VFP 5/6/7, Visual Studio 6
website: www.braziercomputerconsulting.com
email: mbrazier@braziercomputerconsulting.com
<<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 COLOR="#663300"><I>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?</I></FONT>
You could add code in either the AfterPointerMove() or the AfterRequery() methods of the parent bizobj on the one form to send a message to the dependent forms to requery themselves. There is currently no provision in Codebook for managing such messaging, but you could model it after the RegisterBizobj() method of eBizobjForm.
<font color="#cc0000"> ___/
/
__/
/
____/</font>
Ed Leafe
<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
>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.
I'm interested in this one, so could you post the information?
Many thanks in advance.
Marc Van Schandevijl
C-Luma--------------
<I><FONT COLOR="#663300">>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.
I'm interested in this one, so could you post the information?
Many thanks in advance.
</FONT></I>
Marc,
In my sub-classed eBizObj I have:
1) added the properties bizobj_lAllowNew, bizobj_lAllowDelete, and bizobj_lAllowSave.
2) added the following code to the GotFocus event -
this.MakePrimaryBizObj()
DODEFAULT()
3) added the following code to the MakePrimaryBizObj event -
WITH thisform
.lAllowDelete = this.bizobj_lAllowDelete
.lAllowNew = this.bizobj_lAllowNew
.lAllowSave = this.bizobj_lAllowSave
DODEFAULT()
.RefreshForm()
ENDWITH
The code above seems to work in all situations except when you code bizobj's within bizobj's, which was the way the original CB3 worked.
Hope this helps.
Matthew L. Brazier
Developing in VFP 5/6/7, Visual Studio 6
website: www.braziercomputerconsulting.com
email: mbrazier@braziercomputerconsulting.com