Page 1 of 1

[0.15.33] Disabled GUI element produces empty on_click event

Posted: Thu Aug 10, 2017 10:35 pm
by eradicator
Behavior:

Clicking the preperated gui element raises an on_gui_click event but the event.element does not have a .name or a .parent (did not check for further properties) despite evaluating .valid as true.

Reproduction:

1) Create a new GUI element (i.e. a button)
2) Set .enabled=false on the highest of it's parents (the disabled element must not have any visible or invisible elements behind it (i.e. frames, flows, etc).
3) Make sure that no entities are behind the element, game.player.selected must be nil for the bug to occur.
4) Click the GUI element, which will cause on_gui_click to be raised like described in "Behavior".

Code: Select all

local function test_center_gui(LuaPlayer)
  --clicking either frame or button will cause the bug
  LuaPlayer.gui.center.add{name='parentttt',type='flow',enabled=false}
                      .add{name='frame',type='frame'}
                      .add{name='button',type='button',style='slot_button_style'}
  end

Re: [0.15.33] Disabled GUI element produces empty on_click event

Posted: Thu Aug 31, 2017 3:36 pm
by kovarex
The element that is received is the root element center that contains all the elements added to center.
To avoid the confusion in the future, I changed, that these root elements have their widget name set up correctly for 0.16

Re: [0.15.33] Disabled GUI element produces empty on_click event

Posted: Thu Aug 31, 2017 4:02 pm
by eradicator
Oh. Heh. Yea, that would do it. I didn't expect the root itself to raise that event.

Thanks for the answer tho ;)