Old 5th January 2019, 20:17   #1
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 298
Question 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?
Attached Thumbnails
Click image for larger version

Name:	list2019-01-05_23-37-52.jpg
Views:	93
Size:	37.4 KB
ID:	54304  
r2du-soft is offline   Reply With Quote
Old 6th January 2019, 00:06   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,014
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 6th January 2019, 00:34   #3
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 298
Code:

HTML 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
r2du-soft is offline   Reply With Quote
Old 6th January 2019, 01:26   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,014
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...10-17/?p=31973
https://blogs.msdn.microsoft.com/old...20-00/?p=12813

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 6th January 2019, 21:14   #5
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 298
Quote:
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...10-17/?p=31973
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.)
HTML Code:
${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
Attached Thumbnails
Click image for larger version

Name:	2019-01-07_1-03-55.jpg
Views:	79
Size:	28.5 KB
ID:	54308  
r2du-soft is offline   Reply With Quote
Old 7th January 2019, 01:27   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,014
You ignored half of my post. 12u is not enough, should be more like 80u.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 7th January 2019, 08:34   #7
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 298
Quote:
Originally Posted by Anders View Post
You ignored half of my post. 12u is not enough, should be more like 80u.
Sorry
I forgot

HTML Code:
${NSD_CreateDropList} 0 30 80% 80u "test"
Pop $List
SendMessage $List ${CB_SETMINVISIBLE} 8 0 #set the minimum number of visible items in List
r2du-soft is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump