Modernize your PowerBuilder Applications

Toolbar Strip

Add a toolbar to any window or user object in any location without the use of a menu object. With the toolbar control you can:

  • Align buttons to the left and\or right.
  • Display text next to the button image or under it.
  • Group similar items into a drop down menu.
  • Change the visual style.
  • Pick from four built in themes.
  • Apply a small, medium, large or xlarge button size.
  • Display in a vertical or horizontal orientation.
  • Add PB controls like dropdowns and single line edits.
  • Set tooltips for each button.
  • Toggle buttons so they appear selected.


Implementation:

//Open Event of window that contains the control
//Or the post constructor event of the userobject that contains the control 
//Add items to the toolbar
uo_1.of_AddItem('Copy','Copy!')
uo_1.of_AddItem('Paste','Paste!')
uo_1.of_AddSeparator()
uo_1.of_AddItem('First Row','VCRFirst!')
uo_1.of_AddItem('Prior Row','VCRPrior!')
uo_1.of_AddObject('', em_1)
uo_1.of_AddItem('Next Row','VCRNext!')
uo_1.of_AddItem('Last Row','VCRLast!') 

 //Display text with image
uo_1.of_DisplayText(TRUE)

 //THE FOLLOWING CODE ADDS A TOOLBAR ITEM WITH DROP MENU
//Add menu toolbar items
Long ll_group, ll_b, ll_s, ll_o, ll_c
ll_group = uo_toolbarstrip.of_AddGroup()
ll_b = uo_toolbarstrip.of_AddItem('Blue','blue.bmp')
ll_s = uo_toolbarstrip.of_AddItem('Silver','silver.bmp')
ll_o = uo_toolbarstrip.of_AddItem('Olive','olive.bmp')
ll_c = uo_toolbarstrip.of_AddItem('Classic','classic.bmp')
   
uo_toolbarstrip.of_DisplayText(ll_group, TRUE)

//Assign new toolbar items to group 
uo_toolbarstrip.of_AssignItemToGroup(ll_group,ll_b)
uo_toolbarstrip.of_AssignItemToGroup(ll_group,ll_s)
uo_toolbarstrip.of_AssignItemToGroup(ll_group,ll_o)
uo_toolbarstrip.of_AssignItemToGroup(ll_group,ll_c)

 //Set the default group item
CHOOSE CASE uo_toolbarstrip.il_CurrentTheme
CASE uo_toolbarstrip.BLUE
uo_toolbarstrip.of_setgroupitem(ll_group, ll_b)
CASE uo_toolbarstrip.SILVER 
uo_toolbarstrip.of_setgroupitem (ll_group, ll_s)
CASE uo_toolbarstrip.OLIVE
uo_toolbarstrip.of_setgroupitem (ll_group, ll_o)
CASE ELSE
uo_toolbarstrip.of_setgroupitem (ll_group, ll_c)
END CHOOSE