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!

Toolbar and rebar vbaccelerator on MDI form don't show

Status
Not open for further replies.

DriesG

Programmer
Jul 2, 2003
16
0
0
BE
Hello,

I have a rebar and toolbar from vbaccelerator on my MDI parent form. The problem is that the rebar and toolbar do not show when the form is loaded. On my child forms, there is no problem.
On the child form you can place the rebar and toolbar directly on the form. On the MDI form, that is not possible.
On the quick start guide from vbaccelerator they tell that you will have to put a picture box, allign on top, on the MDI form. Then it is possible the draw the toolbar and rebar on the picture box.
But when the form is loaded, only the picture box is shown, not the rebar and toolbar.

This should be the code for a simple menu, but it doesn't work.
Has somebody any idea how to show these bars on a MDI parent form?

Private Sub MDIForm_Load()
With cToolbar1
.ImageSource = CTBStandardImageSources
.ImageStandardBitmapType = CTBStandardSmallColor
.CreateToolbar 16, , True
.AddButton "New", CTBStdFileNew, , , "New", CTBNormal, "New"
.AddButton "Open", CTBStdFileOpen, , , "Open", CTBDropDown, "Open"
End With
With cReBar1
.CreateRebar Me.hWnd
.AddBandByHwnd cToolbar1.hWnd, , , , "Toolbar1"
End With
End Sub

Many thanks for any help.
Best regards,
Dries
 
When you place the controls onto the project, make sure you place them on the picturebox itself and not on the form. Set the align property of the picturebox to 1- align top so it resizes itself.
You will probably have to resize the toolbar control yourself, mainly the width aspect so in the picture_resize event if it doesnt resize, put something similar to this...

Private Sub Picture1_resize()
UserControl.Width = Picture1.Width
End Sub


Other possibilities...
With cReBar1
.CreateRebar Me.hWnd ' <-- should be picture.hWnd???

 
Thank you LPlates

The solution was to change the &quot;.CreateReBar Me.hWnd&quot; to &quot;.CreatReBar Picture.hWnd&quot;

It works great.

thanks again for your help.
Dries
 
I just had a look at the files for the ReBar control, if you open the vbalTBar project or the project with the ReBar usercontrol and double click on the rebar control to bring up its properties, and for the 'Align' property select 'True' and save your changes, open up the group project again and you will be able to draw the control directly onto the MDI form and set the 'Align' property to 1- Align Top and remove the need for the picturebox container.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top