class PlayState extends FlxState
{
var myMenu:MyMenuBar;
override public function create()
{
super.create();
Toolkit.init();
Toolkit.autoScale = false;
myMenu = new MyMenuBar();
add(myMenu);
}
override public function update(elapsed:Float)
{
super.update(elapsed);
}
}
@:build(haxe.ui.macros.ComponentMacros.build("assets/ui/menuView.xml"))
class MyMenuBar extends VBox
{
public function new()
{
super();
fileMenu.text = "My text";
fileItem1.text = "Replaced text 1";
fileItem2.text = "Replaced text 2";
fileItem3.text = "Replaced text 3";
}
}
Expected Behavior
When the
.text
property of a<menu>
item on a<menubar>
, the text on the item should update in-game.Current Behavior
Text does not update, instead keeping the value provided from XML. Child
<menuitem>
elements of a<menu>
can be updated via code as expected.Possible Solution
Steps to Reproduce (for bugs)
<menubar>
element with at least one child<menu>
element.text
property of a<menu>
element via codeMedia
Test app / minimal test case
haxeui-core
andhaxeui-flixel
inProject.xml
import flixel.FlxState; import haxe.ui.Toolkit; import haxe.ui.containers.VBox; import haxe.ui.containers.menus.Menu; import haxe.ui.containers.menus.MenuBar;
class PlayState extends FlxState { var myMenu:MyMenuBar;
}
@:build(haxe.ui.macros.ComponentMacros.build("assets/ui/menuView.xml")) class MyMenuBar extends VBox { public function new() { super(); fileMenu.text = "My text"; fileItem1.text = "Replaced text 1"; fileItem2.text = "Replaced text 2"; fileItem3.text = "Replaced text 3"; } }
Context
I am attempting to replace the text with translated text for the user's chosen language.
Your Environment
haxeui-core
: githaxeui-flixel
: git