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

Docking toolbars 2

Status
Not open for further replies.

Mike Lewis

Programmer
Jan 10, 2003
17,516
Scotland

In many of my apps, I create a toolbar, then dock it to the top of the screen (by calling its Dock method with a param of 0).

In my present app, I want to handle two toolbars in that way. I create them both as usual, and the call Dock(0) for them both. They both appear at the top of the screen, but the second one appears below the first. I would rather see them side by side.

Does anyone know how to achieve that?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Good Tip Chris. Star from me as well, since like Mike I was unaware that these new parameters had been added. Following this logic is there anyway to make this more generic so the actual names of the toolbars don't have to be known. Loop through the _screen.forms collection and check class and docked property for toolbars that are already there when opening and docking a new one?

boyd.gif

 
Thanks for the star, Craig.

A toolbar may be docked at 0 but the x coordinate may not necessarily be immediately to the right of the preceding toolbar if the user has moved it, so whay you suggesting may be more involved than at first appears.

You also stack the toolbars with
Code:
[COLOR=blue]tbr1 = CREATEOBJECT([tbr1])
tbr2 = CREATEOBJECT([tbr2])

WITH tbr1
    .Dock(0,0,0)
    .Show()
ENDW

WITH tbr2
    .Dock(0,0,29)
    .Show()
ENDWITH[/color]


FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.co.uk
 

I am planning to build this logic into my global toolbar manager. The manager keeps track of which toolbars are open, so it should be able to figure out the best location for each new toolbar.

Thanks again, Chris.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Be aware that toolbar position behavior is kind of flaky. Christof did a piece on this in the Advisor Answers column a while back. It's worth looking at.

Also, fyi, the x,y parameters to Dock aren't new. They've been there all along.

Tamar
 

Tamar,

Christof did a piece on this in the Advisor Answers column a while back.

I found it -- it was back in October 01. Should be useful. Thanks.

I've spent nearly two days trying to create a generic industrial-strength toolbar manager. It's much more difficult than I thought. All kinds of little wrinkles to worry about. But it's nearly done now.

Also, fyi, the x,y parameters to Dock aren't new. They've been there all along.[/u]

Well, they were new to me. One of those many things in VFP that I just never noticed.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 

<< later >>

I wish I had read Christof's article before I started all this. It was a great help.

Saturday afternoon, and I've finally got my Toolbar Manager so that it can open and close toolbars just about anywhere, remember the dock status and position as they closed, and restore these the next time they are opened.

Next, I've got to give the user a choice between small buttons and large buttons. That'll probably break everything I've just done.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top