Posted: Sun Aug 14, 2005 8:26 pm
[ RELEASED ]
version 1.1
version 1.1
http://www.purebasic.com
https://www.purebasic.fr/english/
Hi, the app test is missing...eddy wrote:
I updated the app test. (look above)
custom popup example :
I don't understand your problem. Could you post an example ?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.
NoIs there any way this can be fixes so we can use the Arrow function and the popup menu?
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
err i think it isn'tsrod wrote:Eddy, is this library compatible with Danilo's Professional Toolbar lib?
I searched but I didn't found the problem.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.
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