Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to release a toolbar

Status
Not open for further replies.

Koen Piller

Programmer
Jun 30, 2005
841
NL
Hi,
I dont seem to be able to release a toolbar.
Background: I am working on a legacy application. The appl. works with a toolbar object in a myToolbar.scx with buttons to navigate thru the menu.
Now working to replace this toolbar with a usual menu attached to the mainform.
Need to rewrite and/or replace the existing code. On opening the toolbar.scx I can spy on the existing code. However unning the project once, I am unable to reopen/modify the toolbar.scx "File is in Use".
instructions like:
RELEASE form("myToolbar")
or
CLEAR ALL
RELEASE ALL
CANCEL ALL
do not result in the requested.
The only solution I have now: quit
Is there not a quicker solution to 'kill' this "File is in use" and release the toolbar?
Rgds,
Jockey(2)
 
There is no CANCEL ALL, don't know where that came from. Also never heard of RELEASE form("name").
Toolbars have the release method also oTool = NULL will release a toolbar.

It's always problematic to edit something that's currently used/running, that even applies to PRG class definitions, if you begin to edit it VFP asks "Remove classes from memory?", that also applies to vcx classes, forms and should also apply to toolbars. I just tested and it does. Does that question never come up for you? If I click remove the running toolbar exits and I can edit it.

If your code got stuck somehow and you need to get into some sources to edit them, CLEAR ALL is fine, if you don't use some framework that starts up at VFP start and loads several things into memory, but that should have a (re)initialization. If all else fails I restart VFP, it doesn't take long to start, unless you never fixed the task pane init waiting for the non existant gotdotnet site, eg by turning of the task pane start with VFP start.

Bye, Olaf.
 
Olaf,
Thanks,
Indeed a small typo, no cancel all, of course.
This Toolbar is not instantiated by code, it is in a ownform: myToolbar.scx . So in this case myToolbar = .NULL. won't work. VFP keeps on screeming "File is in Use" - If I begin to edit the form there is no question on "remove etc." since I want to look at the code in the .scx
TaskPane is turned off.
Restart of VFP is a solid solution 8 sec's alltogether, just an annoying toolbar.
Thanks,
Rgds,
Jockey(2)


 
oTool = NULL obviously doesn't work out with an SCX toolbar, unless you DO FORM toolbar.SCX NAME oTool LINKED.
oTool being an object reference is normal for forms or toolbars you start by CREATEOBJECT().
CLEAR ALL would close such forms, too.

You also didn't answer whether the dialog I mentioned appears or not.
And you're indirectly saying it isn't closing on CLEAR ALL? Or do you avoid CLEAR ALL?

The simplest manual way to close a toolbar: Undock it and use the close (X) button as with any form.

Bye, Olaf.
 
Olaf,
No the dialog does not appear since I am working with a .scx file, this only comes up when you are working on a .vcx file.
Hmm close button, howcome I did not think of it? Maybe the original programmer had set CloseBox to .F. ? I quickly reinstalled it. Thanks!
You have saved me n-times 8 seconds and n-times annoying and vexatation.
Rgds,
Jockey(2)

 
my working preference would be create a property and assigned it with toolbarclass during form's loading stage.

under form's Load() event:

set classlib to toolbarclass && toolbarclass is your .vcx filename in current working directory

this.addproperty("toolbarmenu")
this.toolbarmenu = createobject("toolbars") && toolbars is your toolbar's class name
this.toolbarmenu.dock(0)
this.toolbarmenu.visible = .t.

Hope it could be help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top