Page 2 of 3

Posted: Sun Aug 14, 2005 8:26 pm
by eddy
[ RELEASED ]

version 1.1

Posted: Sun Sep 04, 2005 11:06 pm
by eddy
[ RELEASED ]

- flag parameter are now optional for toolbar gadgets (combo, checkbox, string, text, button)
- bug fixed : flags not used

Posted: Tue Sep 06, 2005 6:08 am
by Ziltch
:D
Thank you.
This is a great addon to pb.

Posted: Wed Sep 07, 2005 9:31 pm
by Blade
eddy wrote::)

I updated the app test. (look above)

custom popup example :
Hi, the app test is missing...

Posted: Thu Sep 08, 2005 5:26 am
by eddy
True, I removed it.
The lib is stable now

Posted: Sun Oct 23, 2005 7:32 pm
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?

Posted: Tue Oct 25, 2005 12:14 am
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

Posted: Tue Oct 25, 2005 2:14 am
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

Posted: Tue Oct 25, 2005 2:23 am
by eddy
This example works perfectly for me.
Which part should I check ?

Posted: Tue Oct 25, 2005 2:50 am
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.

Posted: Tue Oct 25, 2005 11:46 am
by srod
This is a bum spankingly brilliant library. Well done.

Eddy, is this library compatible with Danilo's Professional Toolbar lib?

Posted: Wed Oct 26, 2005 4:53 pm
by eddy
srod wrote:Eddy, is this library compatible with Danilo's Professional Toolbar lib?
err i think it isn't

Posted: Wed Oct 26, 2005 4:57 pm
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 ?

Posted: Fri Sep 08, 2006 1:05 pm
by Flype
hello,

is this lib PB4 ready ?

Posted: Fri Sep 08, 2006 1:07 pm
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