Hi Michael,
Here is an idea I got from an article on M$'s VFP web site called "Using Toolbars in Visual FoxPro". The basis of the idea is to have basically 3 levels:
1. ToolBar
2. StateManager
3. Forms
In a nutshell your toolbar and statemanager are created (CREATEOBJECT(....)) in your main with global object variable references. Communication between the toolbar and your forms is handled through the statemanager object so toolbars and forms do not need to reference each other directly. For example, the Next button in your toolbar needs to know if it should be enabled or disabled, so it asks the statemanager like so:
THIS.Enabled=oStateManager.IsEnabled("Next")
StateManager would contain an IsEnabled function like so:
FUNCTION IsEnabled(cMethod)
IF TYPE('_SCREEN.ActiveForm.Name') = 'C' &&Is there an active form?
RETURN PEMSTATUS(_SCREEN.ActiveForm, m.cMethod,5) &&Does it contain a Next Method
ENDIF
RETURN .F.
ENDFUNC
Hope this helps. Go to
www.microsoft.com/vfoxpro and search for title to get a more detailed explanation.
>Greetings!
>
>I have a tool bar which loads before selecting a form from a menu to display. When the form is first loaded, it can "see" and reference the tool bar. Then, if the form is unloaded and re-loaded from the menu, it can no longer reference the tool bar, generating errors instead. From what I can see, everything is the same the second time through as with the first.
>
>I understand that the tool bar can be a part of the form's form set, however, since I have multiple form sets, all needing to access the same tool bar, I seem to only ask for trouble by embedding the same tool bar into each form set. Therefore, what can be done??
>
>Thanks!
>
>Michael Reynolds
Colin Magee
Team Leader, Systems Development
Metroland Media Group Ltd.
Mississauga, Ontario, Canada
cmagee@metroland.comNever mistake having a career with having a life.