PDA

View Full Version : Dropdown Lists only displaying 5 entries



John J
11-02-2010, 01:08 PM
My dropdown lists won't display more than 5 entries no matter how many my dataprovider specifies. They will show less than 5, but never more.

Any ideas why this is or how to fix it?

John J
11-08-2010, 09:00 AM
Got back on to this one and figured out that dropdown lists have a private variable set in it's AS file.

private var _rowCount:Number = 5

I can set this in my UI AS to any number I want using this:

dh.rowCount = 10;

But what I really need is for it to adjust to the number of entries in the array that is getting fed to it. I tried -1 hoping that would do it but it doesn't. So I'm guessing I need to do something in UScript that sets rowcount to the array size but have no idea how to access the rowcount var from UScript.

Matt Doyle
11-08-2010, 04:07 PM
The rowCount property should be accessible from UnrealScript. Most likely with something like:


var GFxClikWidget MyDropDownList;
var float MyRowCount;
MyDropDownList = GFxClikWidget(_root.GetObject("mylistinstance", class'GFxClikWidget'));

MyDropDownList.SetFloat("rowCount", MyRowCount);

This assumes a list with an instance name of "mylistinstance" in Flash on the _root. Give that a shot and let me know if it does anything for you.

Blade[UG]
11-08-2010, 04:52 PM
Hmm. I'm poking at this problem, and I've noticed two things -- changing rowCount, at least while populating the list of stuff, doesn't seem to make any difference at all as to how many rows will display in the dropdown. Secondly, you can mousewheel scroll to see the rest of the entries, apparently it needs to have a scrollbar attached to it.

Matt Doyle
11-08-2010, 05:22 PM
If rowCount doesn't work, it could be that there isn't a public accessor for dropdowns to set that property. In that case you could subclass the drop down class and make your own accessors. That being said, looking at DropdownMenu.as, I see:


public function get rowCount():Number { return _rowCount; }
public function set rowCount(value:Number):Void {
_rowCount = value;
if (_dropdown != null && _dropdown.hasOwnProperty("rowCount")) { _dropdown.rowCount = value; }
}

John J
11-08-2010, 10:40 PM
We found the solution......

Just needed some simple AS work:


onEnterFrame = function() {
dh.dropdown.scrollBar = "ScrollBar";
onEnterFrame = null;
}

Thanks for the help thus far Matt!

Matt Doyle
11-09-2010, 10:16 AM
I see. I assumed you wanted all rows visible, rather than wanting a scroll bar. You can also add the scrollbar via the component inspector.

Blade[UG]
11-10-2010, 03:11 AM
I thinK I'd like to have all rows visible, but that appears to be locked down. On the other hand, I guess I'd like to have a scroll bar, but only if there are > 5 elements :D

Matt Doyle
11-10-2010, 10:47 AM
A scroll bar is easy enough. You can add it in code or you can add it using the component inspector. It should only show up if the number of rows is greater than what is set.