Page 1 of 1

Larger toolbar icons....

Posted: Mon Jul 04, 2005 4:30 pm
by Hydrate
Whenever i put an image in the toolbar of a pb executable it shrinks or grows to an exact size, im hoping to have much larger icons, like the ones in mozilla firefox, i was wondering how to go about doing this...

Re: Larger toolbar icons....

Posted: Mon Jul 04, 2005 5:29 pm
by DarkDragon
Hydrate wrote:Whenever i put an image in the toolbar of a pb executable it shrinks or grows to an exact size, im hoping to have much larger icons, like the ones in mozilla firefox, i was wondering how to go about doing this...
Use ButtonImageGadget or the PureTools

Re: Larger toolbar icons....

Posted: Mon Jul 04, 2005 6:10 pm
by Hydrate
DarkDragon wrote:
Hydrate wrote:Whenever i put an image in the toolbar of a pb executable it shrinks or grows to an exact size, im hoping to have much larger icons, like the ones in mozilla firefox, i was wondering how to go about doing this...
Use ButtonImageGadget or the PureTools
Thank you.

Posted: Tue Jul 05, 2005 1:49 am
by Sparkie
I'm not exactly sure how PB creates the ToolBar and it's ImageList, so if there is a better way, I'm all ears. ;)

I first tried by using

Code: Select all

SendMessage_(hTB, #TB_SETBITMAPSIZE, 0, MakeLong(32,32))
SendMessage_(hTB, #TB_SETBUTTONSIZE, 0, MakeLong(36,36))
but that didin't work. I'm guessing this is because the ImageList is created along with the ToolBar, thus disallowing the changes in size. That led me to this, where I replace the original ImageList with a resized copy of itself.

Code: Select all

#TB_SETIMAGELIST = #WM_USER + 48
#TB_GETIMAGELIST = #WM_USER + 49

Procedure MakeLong(lo.w, hi.w) 
  ProcedureReturn (hi * $10000) | (lo & $FFFF) 
EndProcedure 

;--> create some cheesy images to use for toolbar
hFont = LoadFont(0, "Wingdings", 22)
CreateImage(0, 32, 32)
StartDrawing(ImageOutput())
FrontColor(50, 200, 50)
BackColor(228, 228, 228)
DrawingFont(hFont)
DrawText(Chr(34))
StopDrawing()

CreateImage(1, 32, 32)
StartDrawing(ImageOutput())
FrontColor(50, 200, 50)
BackColor(228, 228, 228)
DrawingFont(hFont)
DrawText(Chr(48))
StopDrawing()

CreateImage(2, 32, 32)
StartDrawing(ImageOutput())
FrontColor(50, 200, 50)
BackColor(228, 228, 228)
DrawingFont(hFont)
DrawText(Chr(42))
StopDrawing()

If OpenWindow(0, 0, 0, 350, 250, #PB_Window_SystemMenu |#PB_Window_SizeGadget | #PB_Window_ScreenCentered, "Vertical ToolBar")
  hTB = CreateToolBar(0, WindowID())
  hOldIList = SendMessage_(hTB, #TB_GETIMAGELIST, 0, 0); 
  hNewIList = ImageList_Duplicate_(hOldIList)
  ImageList_Destroy_(hOldIList)
  ImageList_SetIconSize_(hNewIList, 32, 32)
  SendMessage_(hTB, #TB_SETIMAGELIST, 0, hNewIList)
  SendMessage_(hTB, #TB_SETBITMAPSIZE, 0, MakeLong(32,32))
  SendMessage_(hTB, #TB_SETBUTTONSIZE, 0, MakeLong(36,36))
  SendMessage_(hTB, #TB_AUTOSIZE, 0, 0)
  ToolBarImageButton(0, UseImage(0))
  ToolBarImageButton(1, UseImage(1))
  ToolBarImageButton(2, UseImage(2))
  Repeat
    EventID = WaitWindowEvent()
    If EventID = #PB_Event_Menu
      Debug "ToolBar ID: "+Str(EventMenuID())
    EndIf
  Until EventID = #PB_Event_CloseWindow 
  ImageList_Destroy_(hNewIList)
EndIf

Posted: Tue May 02, 2006 6:55 pm
by troy
Hi Sparkie!

Good solution but I found that the toolbar icons display without 32bit alpha-transparency if I turn XP style off in "Compiler Options". Do you know how to fix it?