place a toolbar anywhere ( toolbar + panel )

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

place a toolbar anywhere ( toolbar + panel )

Post by BackupUser »

Code updated for 5.20+

Restored from previous forum. Originally posted by Eddy.

TOOLBAR Standard
You can place some toolbars anywhere in a window.

Code: Select all

OpenWindow(0,0,0,300,300,"oink",#PB_Window_ScreenCentered|#PB_Window_SystemMenu) 

hWndPanel = PanelGadget(1,50,100,200,25)
hWndTB = CreateToolBar(1,WindowID(0));// win = Source of events
ToolBarStandardButton(100,#PB_ToolBarIcon_New)
ToolBarStandardButton(101,#PB_ToolBarIcon_Open)
;
SetParent_(hWndTB,hWndPanel);//move into panel
;
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      End
    Case #PB_Event_Menu
      Select EventMenu()
        Case 100: Beep_( 800,100)
        Case 101: Beep_(1000,100)
      EndSelect
  EndSelect
ForEver
Thanks Danilo - author of toolbar pro
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Eddy.

2nd Inline Toolbar

Code: Select all

hWndTB = CreateToolBar(#ToolBarID,WindowID());// win = Source of eventsToolBarStandardButton(100,#PB_ToolBarIcon_New)
ToolBarStandardButton(101,#PB_ToolBarIcon_Open)
    
hWndPanel = PanelGadget(#PanelID,0,0,1600,0)
    SetParent_(hWndTB,hWndPanel);//move TB into panel
    GetClientRect_(hWndTB, winrect.RECT)    
    ResizeGadget(#PanelID,-1,-1,-1,winrect\bottom-3);//resize panel to toolbar size
ClosePanelGadget()
[img]http://site.voila.fr/libs/ide_sizeable.png[/img]
:D
BlitzBASIC - PureBASIC
Post Reply