• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dropdown With Scrollbar

New Here ,
Aug 12, 2024 Aug 12, 2024

Copy link to clipboard

Copied

Hello!

I have a dowpdownlist  with very many items, and I would like to show it with scollbars instead of a very long list.. I've read about the maximumSize property, but it do not seem to apply... Does someone know how to handle it or to add a scrollbar?

 

var myWin = new Window('dialog', 'My Long List');
myWin.orientation = 'column';
	with(myWin){
	myWin.sText = add('statictext', undefined, 'Select From List:');
	myWin.myFontDrop = add('dropdownlist',undefined,undefined,{items:myLongList,);
	myWin.myFontDrop.selection = 0;
	myWin.btnOK = add('button', undefined, 'OK');
	}
myWin.center();

 

TOPICS
Scripting

Views

219

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2024 Aug 12, 2024

Copy link to clipboard

Copied

Hi @viktor_n, I doubt that you can control this. I think the maximumSize and the preferredSize properties only affect the size of the non-activated dropdown (ie. the control before you click on it, before you invoke the menu). Maybe someone who knows more than me can help, but my guess is that we have no control over the menu display itself via the API. @Peter Kahrel is very knowledgable on ScriptUI.

 

Another option could be to use a Listbox? A ListBox with a filter field might be a good solution to a long font list.

- Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 12, 2024 Aug 12, 2024

Copy link to clipboard

Copied

Thanks @m1b , no matter I use a listbox ot a dropdownlist, if I try to apply size or maximumSize, I always get an empty element with no content ... it seems something wrong the way I try to apply it ...

myWin.myFontDrop = add('listbox {properties: {size: [400,800]}}',undefined,undefined,{items:myLongList});



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2024 Aug 12, 2024

Copy link to clipboard

Copied

(Unnecessary blabbering removed)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2024 Aug 12, 2024

Copy link to clipboard

Copied

The maximumSize property of dropdownlist applies to the control itself, not to the height of the list. You can see that when you use preferredSize, e.g. myWin.myFontDrop.preferredSize.height = 200;

 

If you want to control the number of displayed items you'll have to use a listbox, as Mark suggested. You can read about filtering listboxes in this PDF:

https://creativepro.com/files/kahrel/indesign/scriptui.html

on pp. 37-39

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 12, 2024 Aug 12, 2024

Copy link to clipboard

Copied

Ah.. thanks @Peter Kahrel , I will try!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 13, 2024 Aug 13, 2024

Copy link to clipboard

Copied

LATEST

... so I check the listboxes element, but in the end this is not what I have in mind (UI-wise). It really seems that there is no way to influence the height of the list in a dropdownlist element ... but it also seems to be a questions that just comes out every few years ... 😕

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines