Skip to content
⌘ NSIS Forum Archive

Change the number of items displayed in DropList

7 posts

r2du-soft#

Change the number of items displayed in DropList

DropList can be shown 30 item in list without scroll to down

now the length of the displayed list is a bit big...



I want to display only 10 items in the list AND to display items below Scrolling down to view more items...
Now I want to see how can to change the number of items displayed in the list?
Is there a way to adjust the height of the list item?
Anders#
Classic style uses the height specified when you create the control (you have not posted code so I don't know what you specified). XP style size can be controlled by a message IIRC.
r2du-soft#
Code:

!include "MUI.nsh"
!include "nsdialogs.nsh"

Page custom nsDialogsPage nsDialogsPageLeave
!insertmacro MUI_LANGUAGE English

Var dialog
Var List

Function nsDialogsPage
nsDialogs::Create 1018
Pop $dialog

${NSD_CreateDropList} 0 30 80% 12u "test"
Pop $List

;--------------------
${NSD_CB_AddString} $List "1"
${NSD_CB_AddString} $List "2"
${NSD_CB_AddString} $List "3"
${NSD_CB_AddString} $List "4"
${NSD_CB_AddString} $List "5"
${NSD_CB_AddString} $List "6"
${NSD_CB_AddString} $List "7"
${NSD_CB_AddString} $List "8"
${NSD_CB_AddString} $List "9"
${NSD_CB_AddString} $List "10"
${NSD_CB_AddString} $List "11"
${NSD_CB_AddString} $List "12"
${NSD_CB_AddString} $List "13"
${NSD_CB_AddString} $List "14"
${NSD_CB_AddString} $List "15"
${NSD_CB_AddString} $List "16"
${NSD_CB_AddString} $List "17"
${NSD_CB_AddString} $List "18"
${NSD_CB_AddString} $List "19"
${NSD_CB_AddString} $List "20"
${NSD_CB_AddString} $List "21"
${NSD_CB_AddString} $List "22"
${NSD_CB_AddString} $List "23"
${NSD_CB_AddString} $List "24"
${NSD_CB_AddString} $List "25"
${NSD_CB_AddString} $List "26"
${NSD_CB_AddString} $List "27"
${NSD_CB_AddString} $List "28"
${NSD_CB_AddString} $List "29"
${NSD_CB_AddString} $List "30"
${NSD_CB_AddString} $List "31"
${NSD_CB_AddString} $List "32"
${NSD_CB_AddString} $List "33"
;--------------------

${NSD_CB_SelectString} $List "1"

nsDialogs::Show

FunctionEnd

Function nsDialogsPageLeave

	Pop $List
	${NSD_GetText} $List $0
	messagebox mb_ok "Selected Text Item: $0"

		
FunctionEnd

Section ""
SectionEnd
Anders#
12u is way too small (yes, the combobox design in Windows is stupid).

Turn XPStyle off and adjust the height. Turn it back on and send CB_SETMINVISIBLE.

See also:

r2du-soft#
Originally Posted by Anders View Post
12u is way too small (yes, the combobox design in Windows is stupid).

Turn XPStyle off and adjust the height. Turn it back on and send CB_SETMINVISIBLE.

See also:

https://blogs.msdn.microsoft.com/old...20-00/?p=12813
Thanks Anders
CB_SETMINVISIBLE It works great

(set the minimum number of visible items in the drop-down list of a combo box.)
${NSD_CreateDropList} 0 30 80% 12u "test"
Pop $List
SendMessage $List ${CB_SETMINVISIBLE} 8 0 #set the minimum number of visible items in List
limited Visible item 8 to number
r2du-soft#
Originally Posted by Anders View Post
You ignored half of my post. 12u is not enough, should be more like 80u.
Sorry
I forgot

${NSD_CreateDropList} 0 30 80% 80u "test"
Pop $List
SendMessage $List ${CB_SETMINVISIBLE} 8 0 #set the minimum number of visible items in List
🙂