Jump to content

Recommended Posts

Posted (edited)

I have some 32x32 ico files I'd like to use as icons in a toolbar, but no matter what I do I can't get them to show up. Here's my GUI (or what I have of it so far):

Global Enum $idNew = 1000, $idOpen, $idExtract, $idAdd, $idDelete
Global Enum $extevent = 392, $addevent, $delevent
Func maingui()
$mainwin = GUICreate("Swooshy's Starsiege Volume Manager", 768, 640, Default, Default, $WS_SYSMENU+$WS_MINIMIZEBOX+$WS_CAPTION+$WS_POPUP+$WS_MAXIMIZEBOX, $WS_EX_ACCEPTFILES)

$filemenu = GUICtrlCreateMenu("&File")
$newmitem = GuiCtrlCreateMenuItem("New…", $filemenu)
$openmitem = GuiCtrlCreateMenuItem("Open…", $filemenu)
$opencopymitem = GuiCtrlCreateMenuItem("Open as Copy…", $filemenu)
GUICtrlCreateMenuItem("", $filemenu)
$exitmitem = GUICtrlCreateMenuItem("Exit", $filemenu)

$editmenu = GUICtrlCreateMenu("&Edit")
$selectallmitem = GUICtrlCreateMenuItem("Select All", $editmenu)
$filelistmitem = GUICtrlCreateMenuItem("Save File List", $editmenu)

$optionsmenu = GUICtrlCreateMenu("&Options")


$helpmenu = GUICtrlCreateMenu("&Help")
$aboutmitem = GUICtrlCreateMenuItem("About", $helpmenu)

$rebar = _GUICtrlRebar_Create($mainwin, $RBS_AUTOSIZE+$CCS_TOP+$RBS_VARHEIGHT)
$toolbar = _GUICtrlToolbar_Create($mainwin)
Local $tlbsize = _GUICtrlToolbar_GetMaxSize($toolbar)
$imgs = _GUIImageList_Create(32 ,32, 5)

_GUIImageList_AddIcon($imgs, "emblem-package-2.ico",0,True )
_GUIImageList_AddIcon($imgs, "package-x-genereic.ico",0,True)
_GUIImageList_AddIcon($imgs, "archive-extract-2.ico",0,True)
_GUIImageList_AddIcon($imgs, "archive-insert-2.ico",0,True)
_GUIImageList_AddIcon($imgs, "edit-delete-3.ico",0,True)

$t = _GUICtrlToolbar_SetImageList($toolbar, $imgs)
MsgBox(0 , "Debug", $t)


_GUICtrlToolbar_AddButton($toolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($toolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButtonSep($toolbar)
_GUICtrlToolbar_AddButton($toolbar, $idExtract, $extevent)
_GUICtrlToolbar_AddButton($toolbar, $idAdd, $addevent)
_GUICtrlToolbar_AddButton($toolbar, $idDelete, $delevent)

_GUICtrlRebar_AddToolBarBand($rebar, $toolbar)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

EndFunc

I've figured out that _GUICtrlToolbar_SetImageList is failing for some reason, but I can't figure out why.

Here are the icons I'm using, if it matters: http://min.bz/Rel4sG

Edited by SwooshyCueb
Posted

It's not working because you're not actually using the image list you created. You're using standard icons for the first 2 buttons, and something else for the rest.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...