Advertisement
7_2009-2012 Custom Controls/ Forms/ Menus #217306

Use of the Toolbar Control

Short tutorial on how to use the toolbar in VB4/5 32 bit. http://137.56.41.168:2080/VisualBasicSource/vb4toolbar.txt

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
'first be sure you have add the custom controls
'Microsoft Windows Common Controls -> Comctl32.ocx
'step 1:
'add the control Imagelist
'set the propertie Custom
'General: size 
'Images: click 'Insert Picture' to add the necessary pictures
'step 2:
'add the control Toolbar
'set the propertie Custom
'General: Imagelist
'Buttons: to add a button just click on 'Insert Button'
'at 'Image' you need to set the index-number of the wanted picture 
'this number is the same as the pictures index in the ImageList
'place - if you want - a ToolTipText
'or if you just want text place it behind the propertie 'Caption'
'click on 'OKE' when you are finished
'and the toolbar is ready
'now the code
'put it under the
Private Sub Toolbar1_ButtonClick(ByVal Button As Button)
  Select Case Button.Index
  Case 1	'click on the first button
  Case 2	'click on the second button
  Case 3	'click on the third button
  	'and so on
  End Select
  
End Sub
'you can change most properties a runtime
Toolbar1.Buttons(1).Visible = False 'makes the first button disappear
Toolbar1.Buttons(1).ToolTipText = "an other one" 'change the tooltip text of the first button
Toolbar1.Buttons(2).Enabled = False 'disable the second button
Toolbar1.Buttons(3).Caption = "KATHER" 'change the caption of the third button
'BTW you cannot set the property Toolbar1.ShowTips at runtime!
Original Comments (3)
Recovered from Wayback Machine