General information
Category:
Forms & Form designer
In the destroy event you can check to see if the toolbar object still exists using the debugger. I haven't checked but I think release happens before destroy in which case an object reference in a property may already be released.
>Yes, it is solution for me. It work well. I have another question. Property oToolbar contain reference to mytoolbar. If I want use oToolbar in destroy event of SDI form, VFP tell me, that member oToolbar does not exist. When VFP destroy toolbar? Before destroy event of SDI form or after? I search in toolbar properties some like release method in form. But I found nothing. How can I release toolbar which is referenced to SDI form property (if object is referenced to memory variable simly I release this memory variable)?
>
>Maros
>
>
>>You can do this.
>
>>Add a custom property to your SDI to hold the toolbar object in the scope of the form object. ie. add property oToolBar to the SDI
>
>>Create a custom method in the SDI like sdi.showtoolbar() with the following:
>
>>set classlib to mytoolbarclass additive
>>if type('this.oToolBar') # "O"
>>this.oToolBar = createobject('mytoolbar',this)
>>this.oToolBar.show()
>>endif
>
>>Create a toolbar custom class from baseclass 'toolbar' with showwindow as 'In Top Level Form' and save in mytoolbarclass:
>
>>Create a custom property in the mytoolbar class mytoolbar.oFormRef
>In the init method of the toolbar class put the following:
>
>>lparameters pcFormRef
>>if type('pcFormRef') != "O"
>>* Some message
>>return .F.
>>else
>>this.oFormRef = pcFormRef
>>endif
>
>>In your menu, include a pad View with a dropdown that calls thisform.showtoolbar()
>
>>GOTCHA: You can't launch the toolbar in thisform.Init() because thisform does not yet exist. Therefore use the menu or a button or some tricky thing like mousemove()... ;)
>
>>The reference passed as a parameter to the toolbar is only for making calls to the form from objects on the toolbar easier. For example, a button.click() on the toolbar cannot reference the SDI simply by saying thisform.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only