Skip to content
⌘ NSIS Forum Archive

Checkbox text alignment

7 posts

scharrca#

Checkbox text alignment

Using nsDialogs I have a checkbox control with a long text, so that the text get wraped across three lines.
In this case the square of the checkbox is horizontaly aligned with the text.

Is it possible that the square of the checkbox is aligned with the first row of the text?


Regards
Carsten
Anders#
The layout you are talking about is probably the Windows default.

Showing us your nsDialogs code would be great so I don't have to waste time trying to replicate whatever you are taking about.

Windows version and selected theme/visual style is also useful information to have...
scharrca#
Im on Windows 10 (1709) with default theme/visual style and NSIS 3.03

Using MUI2 and the control is on an custom page with the following code:


${NSD_CreateCheckBox} 120u 40u 100u 30u "Just a long label text so\
that it get wraped to more \
then one line."
Pop $HWND_CheckBox
${NSD_OnClick} $HWND_CheckBox Event_OnClick
In this case the checkbox square is aligned with the 2nd row but i would like to achieve alignment with the 1st row.

Thanks
Carsten
Anders#
https://groups.google.com/d/topic/mi...on/gHgAFaXrXKo claims BS_TOP will work. You can try adding ${BS_TOP} with the NSD_AddStyle macro.
scharrca#
I tried a view button styles beside ${BS_TOP} like ${BS_MULTILINE} and ${BS_TEXT} and a combination of them but now luck yet.

Specifies a combination of button styles. If you create a button using the BUTTON class with the CreateWindow or CreateWindowEx function, you can specify any of the button styles listed below.


A Workaround would be a seperate label but to get the same behave its more coding.
Anders#
nsDialogs defaults to center but you can pick your own style:

nsDialogs::CreateControl ${__NSD_CheckBox_CLASS} ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_TEXT}|${BS_TOP}|${BS_AUTOCHECKBOX}|${BS_MULTILINE} ${__NSD_CheckBox_EXSTYLE}" 120u 40u 100u 30u "Just a long label text so\
that it get wraped to more \
then one line."

Pop $HWND_CheckBox