This is an easier way to handle toolbars. It does dividers and creates buttons from images, not image files. Events can be accessed by EventSource() instead of the button number, since each button is an individual toolbar.
Global toolbarwidth Function ToolBarButton(image,parent) panel=CreatePanel(toolbarwidth,0,8+ImageWidth(image),8+ImageHeight(image),parent) SaveBuffer(ImageBuffer(image),"temp.bmp") toolbar=CreateToolBar("temp.bmp",0,0,ImageWidth(image),ImageHeight(image),panel) DeleteFile "temp.bmp" toolbarwidth=toolbarwidth+8+ImageWidth(image) SetGadgetLayout panel,1,0,1,0 Return toolbar End Function Function ToolbarDivider(parent) gadget=CreateCanvas(toolbarwidth,0,2,24,parent) SetBuffer CanvasBuffer(gadget) LockBuffer CanvasBuffer(gadget) For y=0 To 23 WritePixelFast 0,y,10329505 WritePixelFast 1,y,16777215 Next WritePixelFast 1,0,10329505 UnlockBuffer CanvasBuffer(gadget) FlipCanvas gadget SetGadgetLayout gadget,1,0,1,0 toolbarwidth=toolbarwidth+2 Return gadget End Function