开发者

ColorPicker not editable in Form -> FormItem

开发者 https://www.devze.com 2023-04-13 04:24 出处:网络
Please note the remark mentioned WORKAROUND at the end of this question. Based on a Dictionary based specification, one of my classes creates a Form programmatically.

Please note the remark mentioned WORKAROUND at the end of this question.

Based on a Dictionary based specification, one of my classes creates a Form programmatically.

Adding TextInput or DatePicker to FormItemss works as expected.

Unfortunately, the开发者_如何学C following code just creates a colored rectangle, not the actual picker:

ti = new ColorPicker();

ColorPicker( ti ).selectedColor = TAColor( _spec[ key ].value ).color;

and later on

formItem.addElement( ti );

The Form is embedded in a TitleWindow component presented using

PopUpManager.addPopUp(...);

When added to TitleWindow, it shows up correctly, within Form->FormItem not:

ColorPicker not editable in Form -> FormItem

I can't image, why the picker doesn't appear. Do you?

WORKAROUND:

If I wrap the ColorPicker inside a Group things work:

ti = new Group();
Group( ti ).addElement( new ColorPicker() );

In this case, the ColorPicker appears as editable.

Still, I'd be too happy to learn what the problem with my initial solution. Bug?


A DateField (which extends ComboBase like ColorPicker) behaves properly in a spark Form. But in the ColorPicker, the mouse down handler of the button never gets called. I think that maybe the skin part that handles the mouse clicks (it must be a button) is not properly dimensionned, and the result is it is not shown. I've come to this conclusion because within an mx Form, the ColorPicker doesn't display as it does when it is added to the regular displaylist...

Hope this helps...


In the code you've provided, you never add the colorPicker as a child to any parent container; as such it will never show up anywhere.

You probably need to do something like:

formItem.addChild(ti ); 

[or for a Spark formItem]:

formItem.addElement(ti ); 

I'm confused as to why you're seeing a rectangle.

0

精彩评论

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