Quark wrote on Jun 9th, 2010, 12:34am:Thought I had a problem there but I just tried adding
Code:btnInfo.setVisible(false);
into setup() in the ImageButtons example that comes with the library and the button dissappeared.
So setVisible, works perhaps you might post your code because obviously something else is wrong if the button remains visible.
I drawing buttons for when I place and object (representing an Activity) in a specific area of the screen. I use (still using your previous library atm):
In Activity Class Code: (...)
private void drawChoices() {
for (int i = 0; i < choices.size(); i++) {
Choice chTemp = (Choice) choices.get(i);
chTemp.draw(width/2 - chunk/2 + 6, height - 175 + i * 40);
}
}
In Choice Class Code:(...)
public void draw (int x, int y) {
appeared = true;
choiceBtn = new GButton(pa, name, icon, 1, x, y, 245, 35);
choiceBtn.setImageAlign(GAlign.LEFT);
if (selected) choiceBtn.setColorScheme(GCScheme.GREEN_SCHEME);
else choiceBtn.setColorScheme(GCScheme.GREY_SCHEME);
}
When the object is not on the area of the screen it should be, I run:
In Activity Class Code:(...)
private void removeButtons() {
for (int i = 0; i < choices.size(); i++) {
Choice chTemp = (Choice) choices.get(i);
chTemp.removeButton();
}
}
In Choice Class Code:(...)
public void removeButton() {
if (appeared) choiceBtn.setVisible(false);
appeared = false;
}