PDA

View Full Version : Scrollbar on menu drop-down?


kmeixner
08-11-2009, 11:15 AM
Hello,

I need to generate a menu from a data list of unknown length fetched from a database. I would like to set this drop-down menu to behave similar to a combobox where if there are more than 'n' items in the list it will only display 'n' items but have a scroll bar to scroll up and down.

I do not see any 'shownitems' attribute (or similar) on the menu class and if the list is too long it wraps and overlaps itself in a unusable manner.

Is there a way to add a scrollbar to a menu drop-down? I am using OpenLaszlo 3.4.0

Thanks,

Kevin

kmeixner
08-14-2009, 10:06 AM
Okay, I am close I figured out how to make the scrollbar appear using the menu's parent's floating lists 'shownitems' and 'autoscrollbar' attributes:

<menu name="mnuMain" attach="top" width="85">

<!-- ... -->

<menuitem text="Categories" value="'category'" text_x="0">
<menu name="mnuCategory" attach="right">

<handler name="oninit">
this.flist.setAttribute('shownitems', 5);
this.flist.setAttribute('autoscrollbar', true);
</handler>

<menuitem datapath="category_list:/resultset/record"
text="$path{'@name'}"
value="$path{'@category_id'}"
onselect="mediaFilter.setCategory(this)"
text_x="0"
>
</menuitem>
</menu>
</menuitem>

<!-- ... -->

</menu>

Now the problem I have is when the scroll-bar is clicked the list disappears. How do I override this so that only click on the items (and not the scrollbar) will cause the list to close?

Thanks,

Kevin