drop down list row count problem

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

drop down list row count problem

Fred Brunton
Hi All,

I am trying to adjust the row  count of a DropDownList control so it shows
more rows.

I changed my code from:

var combo:DropDownList = new DropDownList();

to:

var dpl:DropDownList = new DropDownList();
dpl.layout = new VerticalLayout();
dpl.layout["requestedMaxRowCount"] = 12;

This works for changing the max row count as desired.  But the selection
and rollOver colors are no longer good.  The colors only show over the text
in the row and not the entire row as before.

Screen shot:

http://analyticaonline.com/fred/dropdownlist.png

Any help would be greatly appreciated.

Cheers,
Fred
Reply | Threaded
Open this post in threaded view
|

Re: drop down list row count problem

Olaf Krueger
Hi Fred,

try to specify a custom ItemRenderer[1] which sets the width e.g. to "100%"
and pass it to your DDL [2].

Hope this helps,
Olaf

[1] CustomItemRenderer
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                autoDrawBackground="true" width="100%" >
        <s:Label text="{data}"/>
</s:ItemRenderer>

[2]
dpl.itemRenderer = new ClassFactory(CustomItemRenderer);





--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: drop down list row count problem

Fred Brunton
Hi Olaf and others,

Yes, that's a big help.  With CustomItemRenderer now rollover and selected
color looks good, thanks!
What other properties do I need to set to keep same look.  E.g. . No gap
between selected color and rollover color.  Padding.  Row height...?  If
you know that would be great.

Here's what it looks like now.

http://analyticaonline.com/fred/dropdownlist2.png

Thanks again and cheers,
Fred

On Fri, Feb 23, 2018 at 10:15 PM, Olaf Krueger <[hidden email]> wrote:

> Hi Fred,
>
> try to specify a custom ItemRenderer[1] which sets the width e.g. to "100%"
> and pass it to your DDL [2].
>
> Hope this helps,
> Olaf
>
> [1] CustomItemRenderer
> <?xml version="1.0" encoding="utf-8"?>
> <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>                                 xmlns:s="library://ns.adobe.com/flex/spark
> "
>                                 xmlns:mx="library://ns.adobe.com/flex/mx"
>                                 autoDrawBackground="true" width="100%" >
>         <s:Label text="{data}"/>
> </s:ItemRenderer>
>
> [2]
> dpl.itemRenderer = new ClassFactory(CustomItemRenderer);
>
>
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>
Reply | Threaded
Open this post in threaded view
|

Re: drop down list row count problem

Olaf Krueger
In reply to this post by Olaf Krueger
Hi,
the gap should be 0 and the padding 3 (left and right) and 5 (top and
bottom) [1][2].
If you need some more details, I guess this [3] is the default item
renderer.

Hope this helps,
Olaf

[1] Set gap=0
var dpl:DropDownList = new DropDownList();
dpl.layout = new VerticalLayout();
VerticalLayout(dpl.layout).gap  = 0;
VerticalLayout(dpl.layout).requestedMaxRowCount = 12;
dpl.itemRenderer = new ClassFactory(CustomItemRenderer);

[2] Set padding
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                autoDrawBackground="true" width="100%">
       
        <s:Label text="{data}" paddingLeft="3" paddingRight="3" paddingTop="5"
paddingBottom="5"/>
       
</s:ItemRenderer>

[3]
https://github.com/apache/flex-sdk/blob/master/frameworks/projects/spark/src/spark/skins/spark/DefaultItemRenderer.as





--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: drop down list row count problem

Fred Brunton
Great Olaf,

It's working perfectly now. Without your help this would have been very
time consuming for me to figure out.  You are very kind.

Cheers,
Fred

On Sat, Feb 24, 2018 at 4:25 PM, Olaf Krueger <[hidden email]> wrote:

> Hi,
> the gap should be 0 and the padding 3 (left and right) and 5 (top and
> bottom) [1][2].
> If you need some more details, I guess this [3] is the default item
> renderer.
>
> Hope this helps,
> Olaf
>
> [1] Set gap=0
> var dpl:DropDownList = new DropDownList();
> dpl.layout = new VerticalLayout();
> VerticalLayout(dpl.layout).gap  = 0;
> VerticalLayout(dpl.layout).requestedMaxRowCount = 12;
> dpl.itemRenderer = new ClassFactory(CustomItemRenderer);
>
> [2] Set padding
> <?xml version="1.0" encoding="utf-8"?>
> <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>                                 xmlns:s="library://ns.adobe.com/flex/spark
> "
>                                 xmlns:mx="library://ns.adobe.com/flex/mx"
>                                 autoDrawBackground="true" width="100%">
>
>         <s:Label text="{data}" paddingLeft="3" paddingRight="3"
> paddingTop="5"
> paddingBottom="5"/>
>
> </s:ItemRenderer>
>
> [3]
> https://github.com/apache/flex-sdk/blob/master/
> frameworks/projects/spark/src/spark/skins/spark/DefaultItemRenderer.as
>
>
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>
Reply | Threaded
Open this post in threaded view
|

Re: drop down list row count problem

Olaf Krueger
Thanks for your words, I am glad that I could help.

Olaf



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/