Skip to content
⌘ NSIS Forum Archive

How disable a checkbox in ListView

3 posts

BuZzOFF#

How disable a checkbox in ListView

Hi. Tell me please. Whether it is possible to block one of the elements of the ListView? By type: "EnableWindow $var 0".

Download .nsi file

Before:


After:


P.S. Sorry for the Google Translator..
Anders#
I'm not sure if you can disable a item checkbox without a custom imagelist.

If you really want to go down this path you have to create your own state imagelist and draw the checkboxes with DrawFrameControl. This is more code than I feel like writing right now and is hard to get right because you have to deal with Visual Styles etc.
Anders#
If you run control inetcpl.cpl,,6 for example they are using (a TreeView in that case) with a custom state image list. You can see the image if you open inetcpl.cpl with Resource Hacker. They are probably loading it with a custom version of LoadImage(...,LR_LOADTRANSPARENT|LR_LOADMAP3DCOLORS). On Windows 8 this happens in IEFRAME!CRegTreeOptions::InitTree -> IEFRAME!CRegTreeOptions::_CreateImageList (It tries OpenTheme(0,L"Button")+GetThemePartSize+DrawThemeBackground first)

Windows 2000 uses the "flat fat" style from DrawFrameControl: https://wayback.archive.org/web/2016.../screen_02.gif

Windows XP uses DrawThemeBackground: https://wayback.archive.org/web/2016.../c00741753.gif