Larger toolbar icons....

Just starting out? Need help? Post your questions and find answers here.
Hydrate
Enthusiast
Enthusiast
Posts: 436
Joined: Mon May 16, 2005 9:37 pm
Contact:

Larger toolbar icons....

Post 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...
DarkDragon
Addict
Addict
Posts: 2345
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Larger toolbar icons....

Post 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
bye,
Daniel
Hydrate
Enthusiast
Enthusiast
Posts: 436
Joined: Mon May 16, 2005 9:37 pm
Contact:

Re: Larger toolbar icons....

Post 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.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
troy
User
User
Posts: 51
Joined: Sat May 31, 2003 2:59 pm

Post 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?
--
troy
Post Reply