Jump to content

Text on buttons with icons


Clark
 Share

Recommended Posts

$ActGroup2 = GUICtrlCreateGroup("Actions", 50, 360, 520, 50)
$btnRefresh=GUICtrlCreateButton("Refresh",70,375,80,25)
GUICtrlSetImage(-1,"shell32.dll",221,0)
GUICtrlSetTip(-1,"Reset filter and refresh")
$btnExport=GUICtrlCreateButton("Export",170,375,80,25,$BS_ICON)
GUICtrlSetImage(-1,"C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE",1,0)
GUICtrlSetTip(-1,"Export to Excel")
$btnNew=GUICtrlCreateButton("New",270,375,80,25,$BS_ICON)
GUICtrlSetImage(-1,"shell32.dll",1,0)
GUICtrlSetTip(-1,"Create new RFC")
$btnExit = GUICtrlCreateButton("Exit", 370, 375, 80, 25)
GUICtrlSetImage(-1,"shell32.dll",329,0)
$btnOpen = GUICtrlCreateButton("Open", 470, 375, 80, 25)
GUICtrlSetImage(-1,"shell32.dll",290,0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Hi all

In the following screen snap, you will notice that the second and third buttons do not have text, and yet in the code they clearly do.

Does anyone know why this is so?

Posted Image

Link to comment
Share on other sites

Try to remove ,$BS_ICON from the buttons ;)

Hi!

Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

Thanks, that works.

I thought the $BS_ICON was required in order to show the icon. :ermm:

edit: Which doesn't make a lot of sense as the ones that worked didn't have it. :x

Edited by Clark
Link to comment
Share on other sites

All's well that ends well :P

Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>

$hGui = GUICreate('My Program', 650, 460)
$ActGroup2 = GUICtrlCreateGroup("Actions", 50, 360, 520, 50)
$btnRefresh = GUICtrlCreateButton("Refresh", 70, 375, 80, 25)
_GUICtrlSetImage($btnRefresh, "shell32.dll", 221)
GUICtrlSetTip(-1, "Reset filter and refresh")
$btnExport = GUICtrlCreateButton("Export", 170, 375, 80, 25, $BS_ICON)
_GUICtrlSetImage($btnExport, "C:\Program Files\Microsoft Office\Office14\EXCEL.EXE", 1, 0)
GUICtrlSetTip(-1, "Export to Excel")
$btnNew = GUICtrlCreateButton("New", 270, 375, 80, 25, $BS_ICON)
_GUICtrlSetImage($btnNew, "shell32.dll", 1, 0)
GUICtrlSetTip(-1, "Create new RFC")
$btnExit = GUICtrlCreateButton("Exit", 370, 375, 80, 25)
_GUICtrlSetImage($btnExit, "shell32.dll", 329, 0)
$btnOpen = GUICtrlCreateButton("Open", 470, 375, 80, 25)
_GUICtrlSetImage($btnOpen, "shell32.dll", 290, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _GUICtrlSetImage($hButton, $sFileIco, $iIndIco = 0, $iSize = 0)
    Switch $iSize
        Case 0
            $iSize = 16
        Case 1
            $iSize = 32
        Case Else
            $iSize = 16
    EndSwitch
    Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3, 6)
    _GUIImageList_AddIcon($hImage, $sFileIco, $iIndIco)
    _GUICtrlButton_SetImageList($hButton, $hImage)
    Return $hImage
EndFunc   ;==>_GUICtrlSetImage

Edited by AZJIO
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...