Two buttons, two images and switching between them



Hi !

   I`ve got a problem : I have window, with two buttons inside. I`ve got two GtkImage`s, and on a beginning of the program, i`m ( setting gtk_button_set_image () ) these images to be button`s "icons". 
I want to make a signal function, that handles clicking on both of these buttons. On click it should switch images between the buttons. For example i`ve got icon1, icon2, button1 and button2. 
button1 -> icon1
button2 -> icon2 ( icon2 is set to be an icon for button2 )

now.. i`ve got a signal, that button1 is pressed. So i want now, to have situation :

button1 -> icon2
button2 -> icon1

 When I try again to do gtk_button_set_image ( button1, icon2 ) and gtk_button_set_image ( button2, icon1 ) it doesn`t work propertly ( button1 has icon2 , but button2 has no icon ). I suppose it is so because of   button1 is now "parrent" ( or owner ) of both icons ???? I`m not quiet sure. I would be appreciate for any clue how to do this. Maybe there is any method to release icon from being button`s child ? Uhh.. it is little twisted :)



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