Resize listbox based on panel size

Community Beginner ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

Hello,

how can I resize the size of Listbox based on the size of Panel it is in? When user drags the bounds of Panel I would like for the Listbox to match the size of Panel.

onresize.png

On the left is the default size. On the right, panel window was dragged by user down. At this point i would like for the listbox to change its height to fill the extra space at the bottom. 

I want to change only height, not the width. 

 

Here is the part of the code I have:

function preProcessUI(thisObj){
function preProcessUI_buildUI(thisObj){
var myPalette = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Pre-process", undefined, {resizeable:true, closeButton: true});

var list = myPalette.add('ListBox', [0, 0, 460, 300],undefined,
                        {numberOfColumns: 4, showHeaders: true,
                        columnTitles: ['1','2','3', '4'],multiselect:true,columnWidths:[30,20,190,190],});

//Populate list and do other stuff

myPalette.layout.layout(true);

return myPalette;
}

var preProcessUIPal = preProcessUI_buildUI(thisObj);

   if (preProcessUIPal != null && preProcessUIPal instanceof Window){
                 preProcessUIPal.center();
                 preProcessUIPal.show();
              }

           }
           preProcessUI(this);
}

Thanks for help,

Martin

TOPICS
How to , Scripting

Views

19

Likes

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
no replies

Have something to add?

Join the conversation