libgdx Table can't get ChangeListener for a click to fire? -
i have table added stage, , can't click listener fire it:
table table = new table(); table.setx(0); table.sety(0); table.setwidth(300); table.setheight(300); table.addlistener(new changelistener() { @override public void changed(changeevent event, actor actor) { system.out.println("click"); } }); stage.addactor(table);
i've set background 9 patch on table, , it's rendering fine. clicking has no effect. if add label or button table, set same changelistener widgets, listener fires fine.
is there special handling table needs work?
thanks
--------- update -------------------
the way work using eventlistener block interaction on table instance:
table.addlistener(new eventlistener() { @override public boolean handle(event event) { return true; } });
all events fire expected here.
i tried setting table touchable, still changelistener not fire:
table.settouchable(touchable.enabled); table.setlistener(....);
so guess i'm going stick eventlistener approach.
the table
in libgdx not touchable
default, in constructor settouchable(touchable.childrenonly);
(take @ source) called, means, actor
(the `table´) won't input events, children (look @ javadoc).
so enable input events table
, not children, need call settouchable(touchable.enabled)
.
i hope solves problem.
Comments
Post a Comment