Libs : ToolbarPlus

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

It's not the last version.
It's a good idea.
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
QuimV
Enthusiast
Enthusiast
Posts: 337
Joined: Mon May 29, 2006 11:29 am
Location: BARCELONA - SPAIN

Post by QuimV »

Eddy,
Where can I find your ToolBar library?
Is it updated to PB4?
Thanks in advanced for sharing.
QuimV
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

Hello, you might use this include.

Code: Select all

;- 
;- TOOLBAREX.PBI
;- For PureBasic 4.0
;- 

EnableExplicit

;-
;- PRIVATE FUNCTIONS
;-

Procedure.l ToolBarGadgetOpen(toolbar, offsetX, w) 
  Protected t.TBBUTTON, r.RECT, pos.l, ret.l
  pos = SendMessage_(ToolBarID(toolbar), #TB_BUTTONCOUNT,  0, 0)    : ToolBarSeparator() 
  ret = SendMessage_(ToolBarID(toolbar), #TB_GETBUTTON,    pos, @t) : t\iBitmap = offsetX + w 
  ret = SendMessage_(ToolBarID(toolbar), #TB_DELETEBUTTON, pos, 0) 
  ret = SendMessage_(ToolBarID(toolbar), #TB_INSERTBUTTON, pos, t) 
  ret = SendMessage_(ToolBarID(toolbar), #TB_GETITEMRECT,  pos, @r) 
  UseGadgetList(ToolBarID(toolbar)) 
  ProcedureReturn r\left
EndProcedure 
Procedure.l ToolBarGadgetClose(toolbar) 
  UseGadgetList(GetParent_(ToolBarID(toolbar))) 
EndProcedure 

;-
;- PUBLIC FUNCTIONS
;-

ProcedureDLL.l ToolBarDate(toolbar.l, gadget.l, offsetX.l, offsetY.l, w.l, h.l, mask.s) 
  DateGadget(gadget, ToolBarGadgetOpen(toolbar, offsetX, w) + offsetX, offsetY, w, h, mask) 
  ToolBarGadgetClose(toolbar) 
EndProcedure 
ProcedureDLL.l ToolBarButton(toolbar.l, gadget.l, offsetX.l, offsetY.l, w.l, h.l, Text.s) 
  ButtonGadget(gadget, ToolBarGadgetOpen(toolbar, offsetX, w) + offsetX, offsetY, w, h, Text) 
  ToolBarGadgetClose(toolbar) 
EndProcedure 
ProcedureDLL.l ToolBarComboBox(toolbar.l, gadget.l, offsetX.l, offsetY.l, w.l, h.l, flags.l = 0) 
  ComboBoxGadget(gadget, ToolBarGadgetOpen(toolbar, offsetX, w) + offsetX, offsetY, w, h, flags) 
  ToolBarGadgetClose(toolbar) 
EndProcedure 

;-
;- END OF FILE
;-

DisableExplicit
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
QuimV
Enthusiast
Enthusiast
Posts: 337
Joined: Mon May 29, 2006 11:29 am
Location: BARCELONA - SPAIN

Post by QuimV »

Thank You Flype,
Could You send an example of use?
Thanks a lot!! :D
QuimV
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

yes i can but it's already done in page -2- :wink:

Code: Select all

#WINDOW  = 7
#TOOLBAR = 10
#GADGET1 = 1
#GADGET2 = 2

If OpenWindow(#WINDOW, 200, 100, 400, 240, "Test", #PB_Window_SystemMenu)
  
  If CreateToolBar(#TOOLBAR, WindowID(#WINDOW))
    ToolBarStandardButton(1, #PB_ToolBarIcon_New)
    ToolBarStandardButton(2, #PB_ToolBarIcon_New)
    ToolBarStandardButton(3, #PB_ToolBarIcon_New)
    ToolBarSeparator()
    ToolBarDate  (#TOOLBAR, #GADGET1, 1, 1, 120, 21, "%dd / %mm / %yyyy")
    ToolBarSeparator()
    ToolBarButton(#TOOLBAR, #GADGET2, 1, 1, 50, 21, "Exit")
    ToolBarSeparator()
    ToolBarStandardButton(4, #PB_ToolBarIcon_New)
    ToolBarStandardButton(5, #PB_ToolBarIcon_New)
    ToolBarStandardButton(6, #PB_ToolBarIcon_New)
  EndIf
  
  GadgetToolTip(#GADGET1, "DateGadget in toolbar")
  GadgetToolTip(#GADGET2, "Exit")
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_Menu
        If EventMenu() = 1
          Break
        EndIf
      Case #PB_Event_Gadget
        If EventGadget() = #GADGET2
          Break
        EndIf
      Case #PB_Event_CloseWindow
        Break
    EndSelect
  ForEver
  
EndIf 
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
QuimV
Enthusiast
Enthusiast
Posts: 337
Joined: Mon May 29, 2006 11:29 am
Location: BARCELONA - SPAIN

Post by QuimV »

:o
You are right Flype, but this example don't show the use of
ToolBarComboBox.
Thanks in advanced for your help.
QuimV
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Simple change this line:

Code: Select all

ToolBarDate  (#TOOLBAR, #GADGET1, 1, 1, 120, 21, "%dd / %mm / %yyyy")
To

Code: Select all

ToolBarComboBox(#TOOLBAR, #GADGET1, 1, 1, 120, 120)
:wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
QuimV
Enthusiast
Enthusiast
Posts: 337
Joined: Mon May 29, 2006 11:29 am
Location: BARCELONA - SPAIN

Post by QuimV »

:) Thanks ts-soft
QuimV
saimen
New User
New User
Posts: 1
Joined: Tue Mar 31, 2009 11:59 am

Post by saimen »

Do you have this lib for pb4.30??
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I didn't even know this library existed. I'd love to play with it myself. :)
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

It's open source

:arrow: new version for PB 4.30 : http://www.purebasic.fr/english/viewtop ... ht=toolbar
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
ThorstenD
New User
New User
Posts: 8
Joined: Fri Mar 27, 2009 8:48 am

Post by ThorstenD »

Thank you :D
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Thanks. :)
User avatar
PB_Rainer
User
User
Posts: 80
Joined: Fri Jun 07, 2019 1:56 pm

Re: Libs : ToolbarPlus

Post by PB_Rainer »

Hi,

I downloaed the File for ToolbarPlus.

Added it as a Include to my Source and use the functions:

Code: Select all

MyToolBar = CreateToolBar(#PB_Any, GadgetID(MyToolBarContainer),#PB_ToolBar_Large | #PB_ToolBar_Text)
If OpenToolbarGadgetList(Mytoolbar)
	ToolBarImageButton(#Toolbar_load,ImageID(Img_TabWindow_0), #PB_ToolBar_Normal , "Original-Design laden [F3]")
 	SetToolBarArrow()
   SetToolBarPopup(100)
	ToolBarImageButton(#Toolbar_Save,ImageID(Img_TabWindow_1), #PB_ToolBar_Normal , "Design mit Steuerstreifen speichern [F2]")
In Eventhandling this code:

Code: Select all

Select Event		
  	Case #PB_Event_Menu
  		If Event_Menu = #PB_EventType_ToolbarPopup
        DisplayPopupMenu(100,WindowID(TabWindow), ToolbarPopupX(), ToolbarPopupY())
      EndIf
      Select EventMenu()
      	Case 3001 To 3030
      		GetMenuItemText(100, EventMenu())
      		Design_LoadFromList(GetMenuItemText(100, EventMenu()))
				Case #Toolbar_load, 1003
					Icon_Load(EventMenu())
				Case #Toolbar_Save, 1002
All is working fine as long as the source is running in runmode.

After compiling into an EXE the dropdown-arrow will not be highlighted when on it with the mouse. And when clicking to it the popupMenu will not open.
Does anyone can help me?

Thanks in advance
Rainer

More information.
the same exe-file is running an my dell laptop as it should on the hp pc with the described error.
Post Reply