stablexUI create a text with border in haxe

Sorry that Im asking something about stablexui on here but I don’t know where else to ask:
I want to put a border on something in xml it looked like this:
but i cannot seem to put a border on it I have tried:

var scroll = UIBuilder.create(Scroll, {
w: Lib.current.stage.stageWidth,
h:Lib.current.stage.stageHeight,
children : [
UIBuilder.create(Text, {
top: 0,
w: Lib.current.stage.stageWidth,
h: 30,
text: ‘Select Names:’,

                label: {
                    selectable: false
                },
                
                format: {
                    size: Lib.current.stage.stageHeight/20
                },
                
                skin: {
                    paint: {
                        border: 1
                    }
                }
            })
        ]
    });

or with paint with a capital P or without the skin part or without the paint part nothing works the format and label ect. work tho?

1 Like

I think you have to create a Paint instance for the skin and apply it if you are creating your widget in the Haxe main class.

The following works for me:

var widget = UIBuilder.create(Text, {
top: 40,
w: Lib.current.stage.stageWidth,
h: 30,
text: ‘Select Names:’,
label: {
selectable: false
},

        format: {
            size: Lib.current.stage.stageHeight/20
        }
        
       });

    widget.skin = new Paint();
    
    cast(widget.skin, Paint).borderColor = 0xFF0000; //skin adjustments 
    cast(widget.skin, Paint).border = 2;
    
    widget.applySkin();

flash.Lib.current.addChild(widget);

How to put that inside your “children” property of the scroll widget, I am not so sure…

You can assign a glow filter to the label to simulate a border, I use in defaults.xml:

<Text>
    <SampleText
        label-filters = "[ new GlowFilter(0xFFFFFF, 1, 2, 2, 1000) ]"
        format-size = "26"
        format-color = "0xd3cbe4" 
    />
</Text>

Then assign these properties to an ui xml as follows:

<Text defaults="'SampleText'" right="10" top="0" text="'Sample" />