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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a tool bar to a top level form 1

Status
Not open for further replies.

SnyAc

Programmer
Jul 25, 2001
272
US
I'm experimenting with using a tool bar and I can't seem to add one to a top level form. Are tool bars only available at the _screen level?

Any advice is always appreciated.....


Andy Snyder
SnyAc Software Services
 
Andy,

If you think about it, you'll see that a toolbar is redundant in a top-level form. The point about toolbars (at least, in VFP) is that they are independent of forms. They either float on top of all the forms, or are docked to the outer window.

If you simply want a row of buttons at the top of the form, why not just place them there directly?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Andy

Add a new property to your form '.oToolbar' with value of .NULL.

In the .Activate() event of your top-level form put
Code:
[COLOR=blue]WITH THISFORM
[tab]IF ISNULL(.oToolbar)
[tab][tab].oToolbar = CREATEOBJECT([tbrMyToolBar])
[tab][tab].oToolbar.Dock(0,0,0)
[tab][tab].oToolbar.Show()
[tab]ENDI
ENDW[/color]
This assumes you have already created your tbrMyToolBar class and is in a classlib included in your app.

You may need to modify the above code snippit to suit your app.

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Mike... I understand your point about just putting a row of buttons where I want them.... and that's what I'm doing right now. I am exploring the ability to allow the user to dock this row of buttons on any edge of the top level form (which is why I was thinking about a toolbar).

Chris, thanks for your solution. I'll see if I can implement it in a small testbed app....

Andy Snyder
SnyAc Software Services
 
Mike - I get your point, but what if the top-level form is your app's main window. Then, you want toolbars there.

Tamar
 
Andy

Thanks for the star - I omitted to mention that the value of the .ShowWindow property of the top-level form's toolbar needs to be 1.

Top-level forms c/w menu and toolbar(s) can enhance and extend functionality without impacting on the structure of a conventional application, and, as Tamar has pointed out, they can also become the application' main window.



FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top