[Module] ToolBarExModule.pbi

Share your advanced PureBasic knowledge/code with the community.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

[Module] ToolBarExModule.pbi

Post by Thorsten1867 »

ToolBarEx

The module is based on IconBarGadged by "kenmo". (05/2016)

ToolBarEXModule.pbi

Code: Select all

  ; ToolBar::AddItem()                   - Add a clickable ToolBarEx item
  ; ToolBar::AutoSize()
  ; ToolBar::Button()                    - A helper function to create a single-item ToolBarEx which acts like a button gadget
  ; ToolBar::ClearItems()                - Remove all items from an ToolBarEx
  ; ToolBar::CountItems()                - Returns the number of ToolBarEx items (or all positions, including dividers and spacers)
  ; ToolBar::Disable()                   - Disable an ToolBarEx (True, False, or #Toggle)
  ; ToolBar::DisableItem()               - Disable an individual ToolBarEx item (True, False, or #Toggle)
  ; ToolBar::Free()                      - Removes an ToolBarEx and releases all its memory
  ; ToolBar::Gadget()
  ; ToolBar::GetAttribute()              - Get an ToolBarEx attribute (including some read-only attributes)
  ; ToolBar::GetColor()                  - Get an ToolBarEx color
  ; ToolBar::GetDisplayMode()
  ; ToolBar::GetFitHeight()
  ; ToolBar::GetFitWidth()
  ; ToolBar::GetFontID()
  ; ToolBar::GetItemText()               - Get an ToolBarEx item's text (specified by item number, clickable items only)
  ; ToolBar::GetLatchItem()  
  ; ToolBar::GetMargin()
  ; ToolBar::GetPadding()
  ; ToolBar::GetPopupMenu()  
  ; ToolBar::GetRadius()  
  ; ToolBar::GetReturnValue()  
  ; ToolBar::GetSpacing()
  ; ToolBar::GetViewHeight()
  ; ToolBar::GetViewWidth()
  ; ToolBar::Hide()                      - Hide an ToolBarEx (True, False, or #Toggle)
  ; ToolBar::Divider()                   - Add an ToolBarEx divider (vertical line between items)
  ; ToolBar::ItemNumberFromPosition()    - Convert an ToolBarEx position index (zero-based - includes dividers and spacers)
  ; ToolBar::LockRedraw()                - Lock ToolBarEx redraw (True, False, or #Toggle)
  ; ToolBar::LockSizes()                 - Lock ToolBarEx item sizes (True, False, or #Toggle)
  ; ToolBar::PositionFromItemNumber()    - Convert an ToolBarEx Item Number (zero-based - only includes clickable items)
  ; ToolBar::RemoveItem()
  ; ToolBar::Resize()                    - Remove an ToolBarEx item (icon, divider, or spacer) by position
  ; ToolBar::SetColor()                  - Set an ToolBarEx color or reset to default
  ; ToolBar::SetDisplayMode()            - Set the Display Mode (#ImageOnly, #ImageAndText, #TextOnly)
  ; ToolBar::SetFont()                   - Specify a custom font by its FontID (not its PB font number
  ; ToolBar::SetItemText()               - Set an ToolBarEx item's text (specified by item number, clickable items only)
  ; ToolBar::SetLatchItem()              - Specify a latched item by its item number (not its position number)
  ; ToolBar::SetMargin()                 - Set the margin (empty pixels between buttons and gadget border)
  ; ToolBar::SetMouseOverEvents()
  ; ToolBar::SetPadding()                - Set the button padding (pixels between buttons and dividers)
  ; ToolBar::SetPopupMenu()              - Specify a PB popup menu to automatically appear on right-clicks
  ; ToolBar::SetRadius()                 - Set the highlight corner radius (0 = no rounded corners)
  ; ToolBar::SetReturnValue()            - Set the Return Value mode (#ItemNumber, #Position, #UserData)
  ; ToolBar::SetSpacing()                - Set the button spacing (empty pixels between buttons and dividers)
  ; ToolBar::Spacer()                    - Add an ToolBarEx spacer (empty section which automatically fills any extra horizontal space)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: [Module] ToolBarExModule.pbi

Post by Kwai chang caine »

Works nice and looks professional on W10 X64 :shock:
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: [Module] ToolBarExModule.pbi

Post by mk-soft »

Very Cool... Thanks

small bug for mac with fontID

correct...

Code: Select all

Procedure GadgetDefaults()
    Define.i TempGadget
    
    CompilerIf #PB_Compiler_OS = #PB_OS_MacOS    ; Default font
      If GadgetDefault\FontID = #Null
        TempGadget = TextGadget(#PB_Any, 0, 0, 0, 0, "")
        If TempGadget
          GadgetDefault\FontID = GetGadgetFont(TempGadget)
          FreeGadget(TempGadget)
        EndIf
      EndIf
    CompilerElse
      GadgetDefault\FontID = GetGadgetFont(#PB_Default)
    CompilerEndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
HanPBF
Enthusiast
Enthusiast
Posts: 563
Joined: Fri Feb 19, 2010 3:42 am

Re: [Module] ToolBarExModule.pbi

Post by HanPBF »

Very nice!
I like this: download, run, works!

Thanks a lot for sharing!
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: [Module] ToolBarExModule.pbi

Post by Cyllceaux »

If I have no Items,

My app runs extreme slow and dies on line 526
Post Reply