Posts in Category "Containers"

Using Spark Panel with a Scroller

Due to some recent changes to SkinnableContainer, the way in which you add a Scroller to a Spark Panel has changed.

In the past you were able to wrap a Panel in a Scroller and get a scroll bar for the Panel. While this wasn’t the ideal approach, it worked and was a quick and dirty way to add a Scroller. Recently, a change was made such that SkinnableContainer no longer implements IViewPort and as a result, this old approach will no longer work.

The best practice for this scenario is to add a Scroller to the Panel skin. To do so you simply wrap the Panel’s contentGroup with a Scroller. One important thing to remember is that you have to set an explicit size on the Scroller so that it does not auto-resize. An easy way of doing so is either by setting width and height to100% or to use constraints and set top, bottom, left and right all to 0.

For example, to add scroll bars to a Panel you would modify the Panel skin so that it contained something like the following:

panelSkin5.png

Using this approach you will be able to make use of scroll bars on a Spark Panel

Is that component really disabled?

When disabling a container, while its children will appear to be disabled, they are not disabled in the manner that they would be if you set the enabled property to false on them directly. When a container is disabled, it will no longer respond to input from the mouse or keyboard and will apply an alpha to itself and all of its contents. However, the children of the container will not in fact be disabled and so they can still be changed programmatically. For example, if a Panel contains a NumericStepper, and outside of the Panel a Button increments and decrements the NumericStepper’s value, disabling the Panel will not prevent the Button outside of the Panel from changing the value of the NumericStepper. Disabling a container is only intended to prevent direct user interaction with the container (and its children) and to modify the appearance in order to indicate that the container is in fact disabled.