yuri
yuri

Reputation: 585

How can I add scrollbars to a SkinnableContainer created runtime?

I created a SkinnableContainer runtime because I want to set some style properties to it, then based on some external data I need to create a new SkinnableContainer and add it as children of the first one. This children height can be greater than the parent container.

How can I create a SkinnableContainer runtime with some scrollbars?
I read in the documentation that I need to create a new Skin.

It is possible runtime to achieve the same result ?

// ... in a container ...

var father = new SkinnableContainer();
this.addElement(father);

var child = new SkinnableContainer();
// ... some initialization... child is filled with some other elements from outside

father.addElement(child);

// ... now if child.height > father.height 
// I want to add a vertical scrollbar

Upvotes: 1

Views: 1822

Answers (1)

Jason Towne
Jason Towne

Reputation: 8050

You could always put the child in a Scroller control.

For example:

var father = new SkinnableContainer();
this.addElement(father);

var scroller = new Scroller();
var child = new SkinnableContainer();
// ... some initialization... child is filled with some other elements from outside

// scroller.addElement(child); // wrong because you cannot add element to a scroller
scroller.viewport = child.contentGroup; // but you can set this to an IViewport

father.addElement(scroller);
father.addElement(child);

Upvotes: 2

Related Questions