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:
00090339
Views:
22
>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

Michael, I don't know exactly how you setup your toolbar and reference the toolbar from the form, but the usual way to have the common toolbar is to create this toolbar in Application object and have something like that in Form.Init()
if type("oApp")=="O"
	if !empty(thisForm.cToolBarClass)
		if isnull(thisForm.oToolBar)
			thisForm.oToolBar = oApp.AddToolBar(thisForm.cToolBarClass)
			if !thisForm.lShowToolBar
				if type("thisForm.oToolBar")="O" and !isnull(thisForm.oToolBar)
					thisForm.oToolBar.visible = .f.
				endif
			endif
		endif
	endif
endif
oApp.AddToolBar should check if toolbar already exists.

HTH,
Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform