RealyUniqueName / StablexUI

UI engine for Haxe OpenFL designed to give as much freedom as possible in customizing UI
http://ui.stablex.ru/doc
Other
337 stars 80 forks source link

Toggles + RTXml troubles #238

Closed R3D9477 closed 8 years ago

R3D9477 commented 8 years ago

Hi. Toggle don't display text when it loaded with RTXml

Gui.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Toggle
    w="200"
    format-size="20"
    format-color="0x000000"
    states-up-text="'Released state'"
    states-down-text="'Pressed state'" />

this example already work (with UIBuilder): Main.hx

package;

import sys.io.File;

import openfl.Lib;
import openfl.display.*;

import ru.stablex.ui.UIBuilder;
import ru.stablex.ui.RTXml;

class Main extends Sprite {
    static public function main () : Void {
        Lib.current.stage.align = StageAlign.TOP_LEFT;
        Lib.current.stage.scaleMode = StageScaleMode.NO_SCALE;

        UIBuilder.init(null, true);

        Lib.current.addChild(UIBuilder.buildFn("/home/username/Desktop/rtxml-toggle/XmlGui/Gui.xml")());
    }
}

2 1

and this code don't work (RTXml): Main.hx

package;

import sys.io.File;

import openfl.Lib;
import openfl.display.*;

import ru.stablex.ui.UIBuilder;
import ru.stablex.ui.RTXml;

class Main extends Sprite {
    static public function main () : Void {
        Lib.current.stage.align = StageAlign.TOP_LEFT;
        Lib.current.stage.scaleMode = StageScaleMode.NO_SCALE;

        UIBuilder.init(null, true);

        Lib.current.addChild(RTXml.buildFn(File.getContent("/home/username/Desktop/rtxml-toggle/XmlGui/Gui.xml"))());
    }
}

3

Thanks.


same problem with Checkbox Gui.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Checkbox
    format-color="0x000000"
    format-size="20"
    states-up-text="'check me'"
    states-down-text="'uncheck me'" />

and for Group: Gui.xml

<HBox>
    <Radio
        selected="true"
        format-color="0x000000"
        format-size="20"
        group="'group1'"
        states-up-text="'[ ] option 1'"
        states-down-text="'[x] option 1'" />
    <Radio
        format-color="0x000000"
        format-size="20"
        group="'group1'"
        states-up-text="'[ ] option 2'"
        states-down-text="'[x] option 2'" />
</HBox>

and for StateButton text not displayed, too Gui.xml

<?xml version="1.0" encoding="UTF-8"?>
<StateButton
    w="200"
    format-color="0x000000"
    format-size="20"
    order="['one', 'two', 'three']"
    states-one-text="'First state'"
    states-two-text="'Second state'"
    states-three-text="'Third state'" />

I think that RTXml can't parse field "states:ru.stblex.ui.DynamicList"

this differences between checkbox.states, who loaded via UIBuilder (normal): Main.hx:20: { _hash => {down => { _ico => [object Bmp] }, up => { _ico => [object Bmp] }}, _cls => { __name__ => [ru,stablex,ui,misc,BtnState], __construct__ => #function:0, prototype => { skin => null, text => null, set_skinName => #function:1, __class__ => ..., skinName => null, set_ico => #function:1, __properties__ => { set_skinName => set_skinName, set_ico => set_ico, get_ico => get_ico }, __serialize => #function:0, get_ico => #function:0, _ico => null }, new => #function:0 } }

and checkbox.states, who loaded via RTXml (invalid): Main.hx:23: { _hash => {up => {}}, _cls => { __name__ => [ru,stablex,ui,misc,BtnState], __construct__ => #function:0, prototype => { skin => null, text => null, set_skinName => #function:1, __class__ => ..., skinName => null, set_ico => #function:1, __properties__ => { set_skinName => set_skinName, set_ico => set_ico, get_ico => get_ico }, __serialize => #function:0, get_ico => #function:0, _ico => null }, new => #function:0 } }

xml:

<?xml version="1.0" encoding="UTF-8"?>
<Checkbox
    format-color = "0xFFFFFF"
    format-size = "20"
    states-up-ico-src = "'img/checkbox_checked.png'"
    states-down-ico-src = "'img/checkbox_unchecked.png'"
    text = "'checkbox with static text'"/>
RealyUniqueName commented 8 years ago

Sorry for late response. I tried to resolve this issue several times and failed. I can only suggest you switch to other targets, because current versions of neko+hscript act really wierd.

R3D9477 commented 8 years ago

I checked now for -cpp target. This situation is relevant for this target, too. Labels and icons don't work for toggles, when it loaded with RTXml.

RealyUniqueName commented 8 years ago

I've finally found the reason. Your example now works fine for me with latest StablexUI

R3D9477 commented 8 years ago

many thanks! work's fine now!