开发者

how to freeze a label in flex?

开发者 https://www.devze.com 2022-12-11 16:08 出处:网络
I want to have the title of my application to be freezed, that is, even if I scroll down the page, I want the label name to be in focus, at the top always.. I开发者_如何学Cs that possible?

I want to have the title of my application to be freezed, that is, even if I scroll down the page, I want the label name to be in focus, at the top always.. I开发者_如何学Cs that possible?

Now if I scroll down , the screen name disappears. Instead, can it be freezed like freezing columns or rows in excel?


Run this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%">
    <mx:VBox width="100%" height="100%">
        <mx:Label text="My Label!" />
        <mx:VBox width="100%" height="100%" minWidth="0" minHeight="0">
            <mx:CheckBox label="1" />
            <mx:CheckBox label="2" />
            <mx:CheckBox label="3" />
            <mx:CheckBox label="4" />
            <mx:CheckBox label="5" />
            <mx:CheckBox label="6" />
            <mx:CheckBox label="7" />
            <mx:CheckBox label="8" />
            <mx:CheckBox label="9" />
            <mx:CheckBox label="10" />
            <mx:CheckBox label="11" />
            <mx:CheckBox label="12" />
            <mx:CheckBox label="13" />
            <mx:CheckBox label="14" />
            <mx:CheckBox label="15" />
            <mx:CheckBox label="16" />
            <mx:CheckBox label="17" />
            <mx:CheckBox label="18" />
            <mx:CheckBox label="19" />
        </mx:VBox>
        <mx:Label text="Bottom label here!" />
    </mx:VBox>
</mx:Application>

Set minWidth=0 and minHeight=0 so Vbox is not going to expand.


Have you tried ApplicationControlBar - use it with dock set to true.

Quoting from the linked page:

Docked mode: The bar is always at the top of the application's drawing area and becomes part of the application chrome. Any application-level scroll bars don't apply to the component, so that it always remains at the top of the visible area, and the bar expands to fill the width of the application. To create a docked bar, set the value of the dock property to true.


I don't know if I understand you correct, but I would make it the following way:

<mx:VBox width="100%" height="100%" verticalScrollPolicy="off">
   <mx:Label label="My Title" />
   <mx:VBox name="content">
      ...
   </mx:VBox>
</mx:VBox>

So you'll be scrolling just the second VBox and the outer VBox with the title keeps always on top.

0

精彩评论

暂无评论...
验证码 换一张
取 消