haxeui / haxeui-openfl

The OpenFL backend of the HaxeUI framework -
http://haxeui.org
MIT License
42 stars 14 forks source link

bug with "disabled" behaviour #40

Closed Helgiii closed 5 years ago

Helgiii commented 5 years ago

//In this example you cant click the btn

package;

import haxe.ui.Toolkit; import haxe.ui.components.Button; import haxe.ui.containers.VBox; import haxe.ui.core.Screen; import haxe.ui.events.MouseEvent; import openfl.display.Sprite;

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

    Toolkit.init();

    var vbox:VBox = new VBox();
    Screen.instance.addComponent(vbox);

    var btn:Button = new Button();
    btn.text = "hello";
    btn.onClick = OnBtnClick;
    btn.disabled = true;

    vbox.addComponent(btn);

    vbox.disabled = true;
    vbox.disabled = false;

    btn.disabled = false;

    //you cant click that btn
}

private function OnBtnClick(me:MouseEvent)
{
    trace("clicked");
}

}

Helgiii commented 5 years ago

this probably needs to be moved to haxeui-core, I added it here accidentally

ianharrigan commented 5 years ago

Ok, interesting, ill check it out later tonight - thanks.

Helgiii commented 5 years ago

//And one more bug ( it could be the same, or related)

package;

import haxe.ui.Toolkit; import haxe.ui.components.CheckBox; import haxe.ui.components.OptionBox; import haxe.ui.containers.VBox; import haxe.ui.core.Screen; import openfl.display.Sprite;

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

    Toolkit.init();

    var vbox:VBox = new VBox();
    Screen.instance.addComponent(vbox);

    var chk:CheckBox = new CheckBox();
    chk.id = chk.name = "chk1";
    chk.text = "hello";
    vbox.addComponent(chk);

    chk.selected = true;

    //the checkbox appears not to be selected, but when you hover it with the mouse
    //the visual is updated and it becomes ok
}

}

ianharrigan commented 5 years ago

Ok, first issue should be fixed... can you restest and close if it works? The second issue doesnt have anything to do with disabled - its easier to track if each issue only has a single issue. Ill convert it to a separate issue

Cheers, Ian

Helgiii commented 5 years ago

works fine. thanx!