Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How Can You Have One Tool Bar for Multiple Forms?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00090336
Message ID:
00090538
Views:
24
>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

It sounds like what you really want is to have the toolbar be aware of the active form. A brute force method is to have the code in the click event of the toolbar buttons reference _Screen.ActiveForm.... That way when the button in question is clicked, it invokes a method on the active form. You'll have to make certain that the _Screen.ActiveForm.YourMethod exists or you'll get an application error saying the program doesn't exist.

Also, toolbars should be referenced relative to the application object:
Assume you have an application object referenced by a public variable "GoApp". Assume that application object has an array property "toolbars". To create the toolbar you do something like this: goApp.Toolbars[ nCount ] = CREATEOBJECT( 'newToolbar' )
Say the array element that references this toolbar is 3.
And lastly assume the button in question is 'cmdPrint' and you want to click it.
The reference to the toolbar would be: goApp.Toolbars[3].cmdOK.click()

Hope this helps.

Ken
Previous
Reply
Map
View

Click here to load this message in the networking platform