haxeui-core
haxeui-core copied to clipboard
Exception when clicking TabView background
Expected Behavior
When clicking the background of a <tabview>
element with nothing bound to onClick
or other mouse/input events, after first clicking any other focusable UI element, nothing should happen.
Current Behavior
HaxeUI throws an Null access
exception when clicking the background of a <tabview>
element:
haxe.ui.focus.FocusManager.set_focus (c:\Users\Matt\haxe\haxeui-core\git\haxe\ui\focus\FocusManager.hx:98)
haxe.ui.focus.FocusManager.onScreenMouseDown (c:\Users\Matt\haxe\haxeui-core\git\haxe\ui\focus\FocusManager.hx:49)
<local function> (c:\Users\Matt\haxe\lime\7,9,0\src\lime\app\Module.hx:0)
haxe.ui.util.EventMap.invoke (c:\Users\Matt\haxe\haxeui-core\git\haxe\ui\util\EventMap.hx:76)
haxe.ui.core.Screen._onMappedEvent (c:\Users\Matt\haxe\haxeui-core\git\haxe\ui\core\Screen.hx:133)
haxe.ui.backend.ScreenImpl.__onMouseDown (c:\Users\Matt\haxe\haxeui-flixel\git\haxe\ui\backend\ScreenImpl.hx:262)
haxe.ui.backend.flixel.MouseHelper.onMouseDown (c:\Users\Matt\haxe\haxeui-flixel\git\haxe\ui\backend\flixel\MouseHelper.hx:115)
<local function> (c:\Users\Matt\haxe\lime\7,9,0\src\lime\app\Module.hx:0)
openfl.events.EventDispatcher.__dispatchEvent (c:\Users\Matt\haxe\openfl\9,1,0\src\openfl\events\EventDispatcher.hx:402)
openfl.display.DisplayObject.__dispatch (c:\Users\Matt\haxe\openfl\9,1,0\src\openfl\display\DisplayObject.hx:1399)
openfl.display.Stage.__dispatchStack (c:\Users\Matt\haxe\openfl\9,1,0\src\openfl\display\Stage.hx:1307)
openfl.display.Stage.__onMouse (c:\Users\Matt\haxe\openfl\9,1,0\src\openfl\display\Stage.hx:2479)
openfl.display.Stage.__onLimeMouseDown (c:\Users\Matt\haxe\openfl\9,1,0\src\openfl\display\Stage.hx:1855)
<local function> (c:\Users\Matt\haxe\openfl\9,1,0\src\openfl\display\Stage.hx:1706)
lime.app._Event_Float_Float_lime_ui_MouseButton_Void.dispatch (c:\Users\Matt\haxe\lime\7,9,0\src\lime\_internal\macros\EventMacro.hx:91)
lime._internal.backend.native.NativeApplication.handleMouseEvent (c:\Users\Matt\haxe\lime\7,9,0\src\lime\_internal\backend\native\NativeApplication.hx:337)
lime.app.Application.exec (c:\Users\Matt\haxe\lime\7,9,0\src\lime\app\Application.hx:150)
ApplicationMain.create (d:\mslat\MEGA\Documents\code\flixel\haxeui-flixel-kitchensink\export\hl\haxe\ApplicationMain.hx:130)
ApplicationMain.main (d:\mslat\MEGA\Documents\code\flixel\haxeui-flixel-kitchensink\export\hl\haxe\ApplicationMain.hx:25)
Clicking tabs or a button in the tab does not cause an exception.
Possible Solution
focusInfo
on this line is null
when hovering over it in the VS Code debugger. Possibly focusInfo
isn't being updated correctly, or being updated when it shouldn't be.
Steps to Reproduce (for bugs)
- Load the test code below into a new HaxeFlixel project
- Run on the HashLink/Debug target
- Click on the background of the UI container, app should not crash
- Click a button or tab button
- Click the background of the UI container, app should crash
Test app / minimal test case
Used the following XML layout cut down from the HaxeUI component explorer on the website:
<?xml version="1.0" encoding="utf-8" ?>
<vbox width="100%">
<label text="TabView" />
<tabview width="200" height="100">
<box text="Page 1" icon="haxeui-core/styles/default/haxeui_tiny.png">
<button text="Page 1" />
</box>
<box text="Page 2" icon="haxeui-core/styles/default/haxeui_tiny.png">
<button text="Page 2" />
</box>
<box text="Page 3" icon="haxeui-core/styles/default/haxeui_tiny.png">
<button text="Page 3" />
</box>
<box text="Page 4" icon="haxeui-core/styles/default/haxeui_tiny.png">
<button text="Page 4" />
</box>
</tabview>
</vbox>
The following FlxState code was used in a new HaxeFlixel 4.9.0 project:
package;
import flixel.FlxState;
import haxe.ui.Toolkit;
import haxe.ui.containers.Box;
import haxe.ui.containers.VBox;
class PlayState extends FlxState
{
var uiContainer:MainView;
override public function create()
{
super.create();
uiContainer = new MainView();
Toolkit.autoScale = false;
Toolkit.init({container: uiContainer});
add(uiContainer);
}
override public function update(elapsed:Float)
{
super.update(elapsed);
}
}
@:build(haxe.ui.macros.ComponentMacros.build("assets/ui/tabview.xml"))
class MainView extends Box
{
public function new()
{
super();
}
}
Your Environment
- Windows 10 version 2104
- Haxe 4.2.3
- HashLink 1.11
- HaxeFlixel 4.9.0
- "HashLink/Debug" target selected in VS Code