[Module] Extended ToolBar-Gadget (all OS / DPI)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

[Module] Extended ToolBar-Gadget (all OS / DPI)

Post by Thorsten1867 »

ToolBarGadget - Module (All OS / DPI)
  • Image sizes: 16x16 / 24x24 / 32x32
  • Sends either gadget or menu events (#PB_Event_Gadget / #PB_Event_Menu)
  • Separator and spacer elements available
  • Buttons can alternatively be assigned to pop-up menus.
  • Tooltips for individual buttons
  • automatic adjustment of buttons to maximum text width possible
  • automatic adjustment of gadget height possible when using text
  • automatic size adjustment of gadget to window size possible (#MoveX|#MoveY|#ResizeWidth|#ResizeHeight)
  • ComoBox / SpinGadget / ButtonGadget can be added additionally
  • DPI compatible
Image

Code: Select all

; ToolBar::AddItem()              - similar to 'AddGadgetItem()'
; ToolBar::AttachPopupMenu()      - attachs a popup menu to the button
; ToolBar::ButtonText()           - similar to 'ToolBarButtonText()'
; ToolBar::ComboBox()             - adds a ComboBox to the toolbar
; ToolBar::DisableButton()        - similar to 'DisableToolBarButton()'
; ToolBar::DisableReDraw()        - disable/enable redrawing
; ToolBar::Separator()            - similar to 'ToolBarSeparator()'
; ToolBar::EventNumber()          - returns the event number (integer) of the toolbar button
; ToolBar::EventID()              - returns the event ID (string) of the toolbar button
; ToolBar::EventState()           - returns the state of a toolbar gadget (e.g. ComboBox)
; ToolBar::Free()                 - similar to 'FreeToolBar()'
; ToolBar::Gadget()               - similar to 'CreateToolBar()'
; ToolBar::GetAttribute()         - similar to 'GetGadgetAttribute()'
; ToolBar::GetIndex()             - returns item index of the corresponding event number
; ToolBar::GetIndexFromID()       - returns item index of the corresponding event ID
; ToolBar::GetGadgetNumber()      - returns the gadget number of the gadget at index position
; ToolBar::GetState()             - similar to 'GetGadgetState()'
; ToolBar::GetText()              - similar to 'GetGadgetText()'
; ToolBar::ImageButton()          - similar to 'ToolBarImageButton()'
; ToolBar::HideButton()           - hide button
; ToolBar::Height()               - similar to 'ToolBarHeight()'
; ToolBar::SetAutoResizeFlags()   - [#MoveX|#MoveY|#ResizeWidth|#ResizeHeight]
; ToolBar::SetAttribute()         - similar to 'SetGadgetColor()'
; ToolBar::SetColor()             - similar to 'SetGadgetAttribute()'
; ToolBar::SetFont()              - similar to 'SetGadgetFont()'
; ToolBar::SetGadgetFlags()       - [#Top/#Bottom]
; ToolBar::SetPostEvent()         - changes PostEvent [#PB_Event_Gadget/#PB_Event_Menu]
; ToolBar::SetSpinAttribute()     - similar to 'SetGadgetAttribute()' for the SpinGadget [#PB_Spin_Minimum/#PB_Spin_Maximum]
; ToolBar::SetState()             - similar to 'SetGadgetState()'
; ToolBar::SetText()              - similar to 'SetGadgetText()'
; ToolBar::Spacer()               - inserts available space between buttons
; ToolBar::SpinBox()              - adds a SpinGadget to the toolbar
; ToolBar::ToolTip()              - similar to 'ToolBarToolTip()'
; ToolBar::TextButton()           - similar to 'ButtonGadget()'
Download: ToolBarExModule.pbi
Last edited by Thorsten1867 on Fri Dec 20, 2019 3:42 pm, edited 3 times in total.
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] Extended ToolBar-Gadget (all OS / DPI)

Post by Kwai chang caine »

Really nice :D
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by StarBootics »

Super nice.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by Thorsten1867 »

Added:
  • adjust individual buttons to the respective text width (#AdjustButtons)
  • adjust all buttons to the maximum text width (#AdjustAllButtons)
  • Focus with rounded corners (#RoundFocus)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by Andre »

Nice and useful, thanks for sharing! :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by Thorsten1867 »

Added: ComboBox / SpinGadget / ButtonGadget
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by Thorsten1867 »

Update:
  • Bugfixes: Tooltips
  • Added: Tooltips for ComboBox & SpinGadget & TextButton
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ZX80
Enthusiast
Enthusiast
Posts: 330
Joined: Mon Dec 12, 2016 1:37 pm

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by ZX80 »

Thorsten1867
Many thanks for sharing. I'am very sorry, but I have small note: if you click on the names of the buttons in a row, all these buttons will be highlighted. Would be great if it fixed.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by Thorsten1867 »

ZX80 wrote:Thorsten1867
Many thanks for sharing. I'am very sorry, but I have small note: if you click on the names of the buttons in a row, all these buttons will be highlighted. Would be great if it fixed.
Bug fixed
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ZX80
Enthusiast
Enthusiast
Posts: 330
Joined: Mon Dec 12, 2016 1:37 pm

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by ZX80 »

Thorsten1867
1st. Thank you.
2nd. Good, but not enough. Sorry, but now I am not receiving messages in the debugger window when I click on the button. No events.
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by Thorsten1867 »

ZX80 wrote:Thorsten1867Sorry, but now I am not receiving messages in the debugger window when I click on the button. No events.
Bug fixed
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ZX80
Enthusiast
Enthusiast
Posts: 330
Joined: Mon Dec 12, 2016 1:37 pm

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by ZX80 »

Thorsten1867, thank you very much. Now everything is fine.
You are just a klondike with gold codes/modules. I also watch news in the topic: "Chart - Gadget". It's very interesting for me.
User avatar
doctorized
Addict
Addict
Posts: 854
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by doctorized »

Nice code, thanks for sharing! Is there a way to add the text inside the button too? (both image and "new","save", etc inside the button.)
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by Thorsten1867 »

Update: Flag '#TextInside' hinzugefügt.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] Extended ToolBar-Gadget (all OS / DPI)

Post by Thorsten1867 »

Update: Added support for TrackBar gadget
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Post Reply