Listbox height: access question

First off, I am still very early in learning stages, and am in fact editing/modifying an existing set of scripts to add additional functionality. I have run into an issue with a listbox whereby I wish to be able to adjust it's height according to list.items count. However, it always ends up as a single row instead of the normal height by line count.

Here is an example of what I have attempted to do:

 
 
listbox lbx_scripts "" height:25 -- this works and I wish 25 to be max size, but would also like to
 
                                             -- adjust downwards if item count is less than 25
 
 
 
    for j = 1 to displaylist.count do
            (
            format "Displaylist.count = %\r\n" displaylist.count --just to show actual list count
            if displaylist.count <= 25 then lbx_scripts height: displaylist.count
            else lbx_scripts height: 25
             )

Of course the above fails with an error

-- Type error: Call needs function or class, got: ListBoxControl:lbx_scripts <<

I need to know how to access the "height:" property outside of the initial declaration. the listbox named lbx_scripts.height property is only in pixels which appears to be the only height I can adjust outside of that initial declaration line.

Is there anyway that I can access that property to adjust it programmatically?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

Your syntax is wrong.
Use this:

lxb_scripts.height = your value
bannor9's picture

Nope two different properties

Nope two different properties as I explained in the code example.

listboxname.height is different from listboxname height:

the DOT operator affects by pixels the COLON operator affects by number of text lines.

I can't seem to access the COLON version as in:
listbox mylistboxname height:25 equates to a listbox size of 25 lines
listbox mylistboxname.height = 25 gives me a listbox height of 25 pixels.

note no DOT here as DOT height is a slightly different property and is NOT used during construction.

that constructor accesses the height via a different function somehow. the DOTheight is by pixels only.

Is the only way I can do this by approximating the number of pixels used as in
mylistboxname.height = (mylistboxname.count * 10)

to approximate 10 pixels height needed?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.