Author: Charles T. Blankenship
Posted: 1998-06-13 at 22:09:09
<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