Sign in to follow this  
Followers 0
Armag3ddon

Resources UDF + Checkbox + BS_PUSHLIKE

4 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



#2 ·  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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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?

Edited by Armag3ddon

Share this post


Link to post
Share on other sites

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)
1 person likes this

Share this post


Link to post
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
Sign in to follow this  
Followers 0