Armag3ddon Posted June 15, 2012 Share Posted June 15, 2012 (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 June 15, 2012 by Armag3ddon Link to comment Share on other sites More sharing options...
Zedna Posted June 16, 2012 Share Posted June 16, 2012 (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 June 16, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Armag3ddon Posted June 17, 2012 Author Share Posted June 17, 2012 (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 June 17, 2012 by Armag3ddon Link to comment Share on other sites More sharing options...
Zedna Posted August 2, 2012 Share Posted August 2, 2012 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) Armag3ddon 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now