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 »

[ RELEASED ]

version 1.1
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

[ RELEASED ]

- flag parameter are now optional for toolbar gadgets (combo, checkbox, string, text, button)
- bug fixed : flags not used
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Ziltch
User
User
Posts: 52
Joined: Sun Aug 03, 2003 12:05 am
Location: Australia

Post by Ziltch »

:D
Thank you.
This is a great addon to pb.
Blade
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Aug 06, 2003 2:49 pm
Location: Venice - Italy, Japan when possible.
Contact:

Post by Blade »

eddy wrote::)

I updated the app test. (look above)

custom popup example :
Hi, the app test is missing...
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

True, I removed it.
The lib is stable now
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

This looks really sweet, I stumbled across this since the PBOSL version doesnt have combo boxes . actually, these are probably two different products? Anyways, cheers!


On a side note, the Menu Arrow function totally disables the button when set to True, if going by the examples in the help (chm) file. Is there any way this can be fixes so we can use the Arrow function and the popup menu?
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

Shannara wrote:On a side note, the Menu Arrow function totally disables the button when set to True, if going by the examples in the help (chm) file.
I don't understand your problem. Could you post an example ?
Is there any way this can be fixes so we can use the Arrow function and the popup menu?
No
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Hmm, stupid me for not mentioning it in my last post. Sorry about that! I thought I mentioned the example that came with the helpfile.. Here' I'll post it here ..

Code: Select all

Enumeration 
   #TB_1
   #TB_2
   #TB_BUTTON
   #TB_STRING
   #TB_COMBO
   #TB_CHECK
   #POPUP   
EndEnumeration    

OpenWindow(#PB_Any,100,100,360,240,#PB_Window_SystemMenu,"Test") 
CreateGadgetList(WindowID())

;menu
CreateMenu(#PB_Any,WindowID()) 
MenuTitle("File")
menuH=GetSystemMetrics_(#SM_CYMENU)	

;popupmenu for toolbar
CreatePopupMenu(#POPUP)
MenuItem(10,"MenuID 10")
MenuItem(20,"MenuID 20")
MenuItem(30,"MenuID 30")

;statusbar 
hStatus=CreateStatusBar(0,WindowID())
GetClientRect_(hStatus,rc.RECT):statusH=rc\bottom-rc\top

; =================
; TOOLBAR TOP
; =================

;toolbar
hToolbar=CreateToolBar(#TB_1, WindowID()) 
GetClientRect_(hToolbar,rc.RECT):toolbarH=rc\bottom-rc\top
If hToolbar
   ;toolbar combobox
   If ToolbarCombobox(#TB_COMBO,5,0,100,100)
      AddGadgetItem(#TB_COMBO,-1,"combo 1")
      AddGadgetItem(#TB_COMBO,-1,"combo 2")
      AddGadgetItem(#TB_COMBO,-1,"combo 3")
      SetGadgetState(#TB_COMBO,2)  
   EndIf
   ToolBarSpace(5) 
   
   ;toolbar button
   ToolbarButton(#TB_BUTTON,0,0,40,21,"OK")
   ToolBarSpace(10) 
   
   ;toolbar arrow & menu
   ToolBarStandardButton(40, #PB_ToolBarIcon_New):ToolBarToolTip(40,"...")
   SetToolBarArrow(#True)
   SetToolBarMenu(#POPUP) 
   ToolBarSeparator()  
   
   ToolBarStandardButton(50, #PB_ToolBarIcon_New):ToolBarToolTip(50,"MenuID 50") 
   SetToolBarArrow(#False)
   SetToolBarMenu(#POPUP) 
   ToolBarSeparator()  
   
   ToolBarStandardButton(60, #PB_ToolBarIcon_New):ToolBarToolTip(60,"...") 
   SetToolBarMenu(#POPUP) 
   ToolBarSpace(10) 
EndIf 


; =================
; TOOLBAR BOTTOM
; =================

hContainer=GadgetID(ContainerGadget(#PB_Any,0,WindowHeight()-menuH-statusH-toolbarH,WindowWidth(),toolbarH))
If hContainer
   ;toolbar
   hToolbar=CreateToolBar(#TB_2,hContainer) 
   
   ;toolbar string
   ToolbarString(#TB_STRING,5,0,100,21,"blabla") 
   ToolBarSpace(5) 
   ToolBarStandardButton(70, #PB_ToolBarIcon_Properties):ToolBarToolTip(70,"MenuID 70") 
   ToolBarSeparator() 
   
   ;toolbar checkbox 
   ToolbarCheckBox(#TB_CHECK,0,0,80,21,"check me")
   ToolBarSpace(10) 
   ToolBarSeparator() 
   
   ;toolbar text
   TextID=ToolbarText(#PB_Any,0,0,90,21," text...",#PB_Text_Border)   
   CloseGadgetList()
EndIf

; =================
; CLIENT AREA
; =================

ContainerGadget(#PB_Any,0,toolbarH,WindowWidth(),WindowHeight()-menuH-statusH-toolbarH*2,#PB_Container_Double)
CloseGadgetList()


Repeat 
   e=WaitWindowEvent()
   If e=#PB_Event_Gadget 
      et.s=Str(EventType())
      gs.s=Str(GetGadgetState(EventGadgetID()))
      Select EventGadgetID()
         Case #TB_COMBO
            StatusBarText(0,0," COMBOBOX >> GadgetState = "+gs+" >> EventType = "+et)
         Case #TB_BUTTON  
            StatusBarText(0,0," BUTTON >> GadgetState = "+gs)
         Case #TB_CHECK
            StatusBarText(0,0," CHECK >> GadgetState = "+gs) 
         Case #TB_STRING 
            If EventType()=#PB_EventType_ReturnKey : et = "PB_EventType_ReturnKey" : EndIf       
            StatusBarText(0,0," STRING >> EventType = "+et)
         Default 
            Debug EventGadgetID()
      EndSelect
   EndIf
   If e=#PB_Event_Menu 
      StatusBarText(0,0," TOOLBAR >> MenuID = "+Str(EventMenuID()))
   EndIf
   
Until e = #PB_Event_CloseWindow
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

This example works perfectly for me.
Which part should I check ?
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

I dont know really, I simply copied that example (From your help file) to japbe and ran it. When I clicked on the down arrow, it does nothing, not even show the click image, and no menu pops up .. I'll debug through it again, but it doesnt popup an error or anything. Hrm.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

This is a bum spankingly brilliant library. Well done.

Eddy, is this library compatible with Danilo's Professional Toolbar lib?
I may look like a mule, but I'm not a complete ass.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

srod wrote:Eddy, is this library compatible with Danilo's Professional Toolbar lib?
err i think it isn't
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

Shannara wrote:I dont know really, I simply copied that example (From your help file) to japbe and ran it. When I clicked on the down arrow, it does nothing, not even show the click image, and no menu pops up .. I'll debug through it again, but it doesnt popup an error or anything. Hrm.
I searched but I didn't found the problem.
Did you use PB 3.94 ?
Did you download the last version of my lib ?
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
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,

is this lib PB4 ready ?
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
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

at the moment i use your old code that i modified a little to work as i need it.

Code: Select all

; ///////////////////////////// 

ProcedureDLL.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 

ProcedureDLL.l ToolBarGadgetClose(toolbar) 
  UseGadgetList(GetParent_(ToolBarID(toolbar))) 
EndProcedure 

ProcedureDLL.l ToolBarButton(toolbar, gadget, offsetX, offsetY, w, h, text.s) 
  Protected x.l = ToolBarGadgetOpen(toolbar, offsetX, w)
  ButtonGadget(gadget, x + offsetX, offsetY, w, h, text) 
  ToolBarGadgetClose(toolbar) 
EndProcedure 

ProcedureDLL.l ToolBarDate(toolbar, gadget, offsetX, offsetY, w, h, mask.s) 
  Protected x.l = ToolBarGadgetOpen(toolbar, offsetX, w)
  DateGadget(gadget, x + offsetX, offsetY, w, h, mask) 
  ToolBarGadgetClose(toolbar) 
EndProcedure 

; ///////////////////////////// 

#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
Post Reply