Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

LibGdx Table not firing touch events

$
0
0

I can easily add listeners to the actors within a table, and they will fire events, but if I want an entire to table to have 1 listener and do not care to have differentiated effects depending on where it is touched, I want to be able to add the listener directly to the table. However, it is not firing, at all. I have turned on debug and tried pressing within the labels in the table or outside of them (still in the table, like on padding), but to no avail.

This is how I add the create the table:

il = new InfoListener();// extends ClickListener
info = new Table(skin);
info.setBackground("default-rect");
info.setVisible(false);
info.addListener(il);
info.setDebug(true);

// later on I have a method that adds things to the table
info.clear();
info.add(item.getDescription()).padRight(5);

info.setVisible(true);
info.setSize(info.getPrefWidth(), info.getPrefHeight());

It is a dynamic table (i.e. I change it’s children when necessary), but that shouldn’t make a difference. How do I have the table fire touch events?


Viewing all articles
Browse latest Browse all 434

Trending Articles