Jump to content

Recommended Posts

Posted (edited)

Hi! ;)

I'd like to assign an icon to a checkbox with BS_PUSHLIKE and BS_ICON style. I use the same code I use for all my other buttons in that GUI, very simple:

Local $quickedit = GUICtrlCreateCheckbox("", 595,536, 24,24, BitOR($BS_PUSHLIKE, $BS_ICON))
_ResourceSetImageToCtrl($quickedit, "QE_ICON")

As I said, all other buttons work fine like this:

Local $refresh = GUICtrlCreateButton("", 595,285, 24,24, $BS_ICON)
_ResourceSetImageToCtrl($refresh, "REFRESH_ICON")

Just the checkbox does not show an icon (it's an empty button instead). QE_ICON itself works fine when I assign it to something else. I've seen somewhere in this forum that it is possible to assign an icon to a pushlike checkbox. Just doesn't work in combination with the UDF for me.

So, is it possible to combine these two things?

Edited by Armag3ddon
Posted (edited)

All works fine I use it this way in my project.

Way of use depends on type of your "icon"

for icon type:

#AutoIt3Wrapper_Res_Icon_Add=your_icon.ico

$quickedit = GUICtrlCreateCheckbox("", 595,536, 24,24, BitOR($GUI_SS_DEFAULT_CHECKBOX,
$BS_PUSHLIKE, $BS_ICON))
GUICtrlSetImage($quickedit, @ScriptFullPath, -5, 0)

for bitmap type:

#AutoIt3Wrapper_Res_File_Add=your_icon.bmp, rt_bitmap, QE_ICON

$quickedit = GUICtrlCreateCheckbox("", 595,536, 24,24, BitOR($GUI_SS_DEFAULT_CHECKBOX,
$BS_PUSHLIKE, $BS_BITMAP))
_ResourceSetImageToCtrl($quickedit, "QE_ICON", $RT_BITMAP)

EDIT:

Post your Autoit3Wrapper syntax for your "icon"

I think you used wrong BS_ICON style for BITMAP resource

You also missed $RT_BITMAP in _ResourceSetImageToCtrl()

Edited by Zedna
  • 1 month later...
Posted

  On 6/17/2012 at 12:05 AM, 'Armag3ddon said:

That probably is the problem. The file is neither .ico nor .bmp but a PNG.

#AutoIt3Wrapper_Res_File_Add=.resquickedit.png, rt_rcdata, QE_ICON

Using it like this works fine for every button. But from your answer I assume that this is hacky and I should convert them into icons/bitmaps?

It should work this way - conversion from PNG to BMP does _ResourceSetImageToCtrl() internally for you:

#AutoIt3Wrapper_Res_File_Add=your_icon.png, rt_rcdata, QE_ICON

$quickedit = GUICtrlCreateCheckbox("", 595,536, 24,24, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE, $BS_BITMAP))
_ResourceSetImageToCtrl($quickedit, "QE_ICON", $RT_RCDATA)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...