Re: Retrieving Button from Table



>I put buttons into a 3x3 table.  Each button has a label set to a space. 
>When clicked it is gets set to an X or O. When someone wins or no  winneer
>is possible, I need to reset the X/O values back to space.  I do not see
>how to access the button to reset the value.

there are probably ways within GTK, but why not:

GtkWidget *buttons[3][3];
int i, j;

for (i = 0; i < 3; i++) {
   for (j = 0; j < 3; j++) {
        buttons[i][j] = gtk_button_new (...whatever...);
        gtk_table_attach (GTK_TABLE(table), buttons[i][j], ....);
   }
}

then just use the array whenever you want to access the buttons directly.

--p




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]