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

can't to change state-* properties #252

Closed R3D9477 closed 7 years ago

R3D9477 commented 8 years ago

Hi. I trying to change state properties of dynamically generated checbox:

package;

import openfl.display.Sprite;

class Main extends Sprite {
    public function new () {
        super ();

        var cb = new ru.stablex.ui.widgets.Checkbox();

        cb.states.get("up").text = "UP";
        cb.states.get("down").text = "DOWN";

        this.addChild(cb);
    }
}

but I see a blank screen.

Linux Mint 18 x16 latest StablexUI from git openfl 4.4.1 lime 3.4.1 haxe 3.2.1 neko 2.1.0

targets: neko and cpp

Any ideas? Thanks.

RealyUniqueName commented 8 years ago

Try UIBuilder.create(CheckBox) instead of invoking constructor directly

R3D9477 commented 8 years ago

changed to

package;

import openfl.display.Sprite;

class Main extends Sprite {
    public function new () {
        super ();

        var cb = ru.stablex.ui.UIBuilder.create(ru.stablex.ui.widgets.Checkbox);

        cb.states.get("up").text = "UP";
        cb.states.get("down").text = "DOWN";

        this.addChild(cb);
    }
}

but without effect I see the blank screen

RealyUniqueName commented 8 years ago

Did you invoke UIBuilder.init() somewhere?

R3D9477 commented 7 years ago

Ah, sorry, I've missed it. I changed source to:

package;

import openfl.display.Sprite;

class Main extends Sprite {
    public function new () {
        super ();

        ru.stablex.ui.UIBuilder.init();

        var cb = ru.stablex.ui.UIBuilder.create(ru.stablex.ui.widgets.Checkbox);

        cb.states.get("up").text = "UP";
        cb.states.get("down").text = "DOWN";

        this.addChild(cb);
    }
}

but it also have not effect

123

R3D9477 commented 7 years ago

just needed to call method updateState() manually. is it possible to call this method automatically after status changed?

RealyUniqueName commented 7 years ago

That should be called automatically when creating UI via xml. I will try to make it work without xml later this week.

R3D9477 commented 7 years ago

Thanks!