Toolbar+ dropdown arrow, popupmenu, toggle buttons, gadgets

Share your advanced PureBasic knowledge/code with the community.
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: Toolbar+ dropdown arrow, popupmenu, toggle buttons, gadg

Post by yrreti »

8) Thanks eddy and PureLust
LuaDev
User
User
Posts: 33
Joined: Tue Feb 16, 2010 2:41 pm

Re: Toolbar+ dropdown arrow, popupmenu, toggle buttons, gadg

Post by LuaDev »

Hey Eddy

Great include, iv used it many times, but i was asked to create a bigger toolbar with 24x24 icons so i made a small edit to the main function, as i was pleased with the result i thought id post the function in this thread for everyone else

simply replace the CrerateToolBarPlus function with the below one, pass a 'Size' of 16 or 24

Code: Select all

ProcedureDLL CreateToolBarPlus(ID, Parent, Size=16) ;Create toolbar plus

  Shared ToolbarPlusParent
  Shared ToolbarPlus
  Shared ToolbarPlusID
  Result=CreateToolBar(ID, parent)
  ToolbarPlusID=ID
  ToolbarPlusParent=parent
  ValidateGadgetID(Result, ToolbarPlusID, ToolbarPlus)
  
  ; ====================
  ; Change Style
  ; ====================
  #TB_SETEXTENDEDSTYLE=$400+84
  #TB_GETEXTENDEDSTYLE=$400+85
  #TBSTYLE_EX_DRAWDDARROWS=$1
  Protected es=SendMessage_(ToolbarPlus, #TB_GETEXTENDEDSTYLE, 0, 0) | #TBSTYLE_EX_DRAWDDARROWS
  SendMessage_(ToolbarPlus, #TB_SETEXTENDEDSTYLE, 0, es)

  hImageList = ImageList_Create_(Size, Size, #ILC_COLOR32 | #ILC_MASK, 20, 0)
  If hImageList
    SendMessage_(ToolbarPlus, #TB_SETIMAGELIST, 0, hImageList) 
    Select Size
      Case 24
        SendMessage_(ToolbarPlus, #TB_LOADIMAGES, #IDB_STD_LARGE_COLOR, #HINST_COMMCTRL)
        SendMessage_(ToolbarPlus, #TB_LOADIMAGES, #IDB_HIST_LARGE_COLOR, #HINST_COMMCTRL)
        SendMessage_(ToolbarPlus, #TB_LOADIMAGES, #IDB_VIEW_LARGE_COLOR, #HINST_COMMCTRL) 
      Default
        SendMessage_(ToolbarPlus, #TB_LOADIMAGES, #IDB_STD_SMALL_COLOR, #HINST_COMMCTRL)
        SendMessage_(ToolbarPlus, #TB_LOADIMAGES, #IDB_HIST_SMALL_COLOR, #HINST_COMMCTRL)
        SendMessage_(ToolbarPlus, #TB_LOADIMAGES, #IDB_VIEW_SMALL_COLOR, #HINST_COMMCTRL)
    EndSelect
  EndIf
    
  SendMessage_(ToolbarPlus, #TB_AUTOSIZE, 0, 0)
  ShowWindow_(ToolbarPlus,  #True)
  
  ProcedureReturn Result
    
EndProcedure
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: Toolbar+ dropdown arrow, popupmenu, toggle buttons, gadg

Post by yrreti »

Thanks for sharing your code for using larger icons LuaDev
But there must be some other changes you made too, as I get
several EnableExplicit errors with your modified procedure.
I've never been very good in working with Enable Explicit problems,
but I corrected the ones that erred, as least they didn't error again.
But then I got Constant not found:#TOOLBAR - which is in your
example program? I'm using the latest PB4.61beta.
Thanks for your input.
Post Reply