About   -   Contact   -   Purchase   -   Search   -   What's New

Smoothly Docking Your Toolbar
When I was developing PBDelta I wanted the toolbar to have a certain look and feel. I always wanted it docked at the top of the frame and I wanted to always dock the sheet bar with the frame bar to reduce the amount of real estate that the toolbar used.

The first thing to do was to make the toolbars so they could not be moved. In the application open event I added the following line of code:

this.ToolBarUserControl = FALSE

This stopped the user from being able to alter the look and feel of the toolbar and stop them from moving it around. Next on the list was to dock the sheet bar to the toolbar. The code to dock the sheet bar to the frame bar is in the sheet and is as follows:

this.SetToolbarPos( 1, 1, 1, FALSE )

The problem being is that the Sheet bar is under the control of the menu object and the menu object is automatically created by the underlying PowerBuilder code so it appears as a second tool bar under the frame bar and then when the above code executes the sheet bar moves into its correct position. This look very naff!

There are two solution, first you can set redraw off on the frame before you open the sheet, the sheet can then dock the toolbar and then set redraw back on at the frame level. The best solution is to goto the sheet properties, the last tab is the Toolbar tab, uncheck the visible option. Then in your sheet open event add the following code:

this.SetToolbarPos( 1, 1, 1, FALSE )
this.Toolbarvisible = TRUE

Now the sheet will open and the toolbar will be docked next to the frame bar with out the annoying jump.


Top of Page

Legal Notice

Ken Howe 2011