func_maxgui_toolbars_createtoolbar.rst 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. .. _func_maxgui_toolbars_createtoolbar:
  2. =============
  3. CreateToolBar
  4. =============
  5. CreateToolBar -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. CreateToolBar:TGadget(source:Object,x,y,w,h,group:TGadget,style=0)
  10. Create a ToolBar gadget.
  11. A ToolBar is created from a source pixmap that contains a row of equally
  12. shaped images. Any images in the row left blank are treated as ToolBar
  13. separators. A ToolBar generates the following events:
  14. [ @{Event ID} | @Description
  15. * EVENT_GADGETACTION | A toolbar item has been selected/clicked. Event data contains the item index.
  16. ]
  17. The recommended image size is 24x24 pixels which seems to work well on all
  18. platforms. Using a different image size may result in the pixmaps being scaled
  19. before being set depending on the OS.
  20. The @source parameter can either be a #TPixmap or a URL to an image
  21. file from which @CreateToolBar loads a pixmap.
  22. See Also: #AddGadgetItem, #EnableGadgetItem, #DisableGadgetItem and #SetToolBarTips.
  23. Parameters
  24. ==========
  25. Return Values
  26. =============
  27. Nothing.
  28. Examples
  29. ========
  30. .. code-block:: blitzmax
  31. ' createtoolbar.bmx
  32. Import MaxGui.Drivers
  33. Strict
  34. Local window:TGadget=CreateWindow("My Window",50,50,480,240)
  35. Local toolbar:TGadget=CreateToolBar("toolbar.bmp",0,0,0,0,window)
  36. SetToolBarTips toolbar,["New","Open","Save~nmy soul"]
  37. AddGadgetItem toolbar,"hello",GADGETITEM_TOGGLE,2,"This item is a quick test of GADGETITEM_TOGGLE"
  38. DisableGadgetItem toolbar,2
  39. While WaitEvent()
  40. Select EventID()
  41. Case EVENT_GADGETACTION
  42. If EventSource()=toolbar
  43. Print "ToolBar GadgetAction~nEventData()="+EventData()
  44. EndIf
  45. Case EVENT_WINDOWCLOSE
  46. End
  47. End Select
  48. Wend
  49. See Also
  50. ========