Announcement

Collapse
No announcement yet.

CLIK Components | Autosize & Width property problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CLIK Components | Autosize & Width property problem

    The UI I'm currently working on will be localized so trying to adjust the layout based upon the text content.

    The design of a specific button requires autoSize to adjust the border width to the text. (It's left aligned)

    Whilst this works fine, I can't dynamically adjust the layout because the width property of autosized CLIK buttons reports the initial width of the component, not the display width (once the label has been updated). I've also tried referencing the textField width, but that also is static.

    Any work arounds for this, or something I've missed?

    Any help would be greatly appreciated.

    #2
    Ok, idiot here. Will use the buttonBar component instead - seems a better solution for this.

    Comment


      #3
      Well that didnt work. Appearance fine, but see no way of making a buttonBar buttons toggleable? tried populating with radioButtons but won't accept them. Can buttonGroup and buttonBar be used together?

      Comment


        #4
        Finally figured it out

        For reference to anyone who comes across the same problem extending the Button Class & overriding the alignForAutoSize function seems to work fine!
        Code:
        package com.myui.controls
        {
        	import scaleform.clik.controls.Button;
        	
        	public class myButton extends Button
        	{
        	private var _newWidth:Number;
        	
        		public function myButton()
        		{
        			
        		}
        		
        		override protected function alignForAutoSize():void
        		{
        			super.alignForAutoSize();
        			_newWidth = _width = super.calculateWidth();
        		}
        		
        		public function get realWidth():Number
        		{
        			return _newWidth;
        		}
        	}
        }
        Note: the realWidth function will only calculate correctly if run from configUI() or during runtime.

        Comment

        Working...
        X