I've inherited a code that does this:
if (ok){
m_Test_Button.set_image(m_Image_OK);
m_Test_Button.set_image_position(Gtk::POS_RIGHT);
m_Test_Button.set_always_show_image(true);
}else{
m_Test_Button.set_image(m_Image_not_OK);
m_Test_Button.set_image_position(Gtk::POS_RIGHT);
m_Test_Button.set_always_show_image(true);
}
At certain points, the previous programmer who wrote that code attempted to use m_Test_Button.set_always_show_image(false);
to hide the image. However, that does not really work to hide the image; it remains visible when it should stop being visible, which is a potential cause of confusion for users when changing parameters because the previous test's status prior to the change still remains visible.
I guess I can hide it just by using a blank image in its place, but there are reasons not to do it (like alignment considerations, and the fact that it looks like a kludge rather than a solution).
The Gtk::Button
help does not even mention set_always_show_image()
or almost anything at all related to images (other than an icon path). The only documentation I've found online seems to indicate that as the name implies, this function might not hide the image.
So I'm in the blue as for what to do to properly hide the image. I've no previous experience with Gtkmm.
Update: The underlying problem was that, partly due to my inexperience with Gtkmm, I was checking the docs for a different version of Gtkmm to the one I was using. Thanks to the commenters for making me aware of this.