Re: Change a Button Pixlabel out of a Dialog



Hello Alex:

I created a test case that does precisely what your code is doing. It
fails to display an image on my button. Instead it displays a "missing
image" icon.  It does not seg-fault and I get no Xlib messages.  That
your application is not displaying the "missing icon" image on the
button probably indicates some other problem that is the root cause of
the Xlib messages and the seg-fault you're experiencing.

When I actually specify the full path name of the image in the call to
Gtk::Bin::add_pixlabel, it works fine.  I do not know what "ICONPATH"
is, but I'm assuming that it is a macro defined to a string literal; so
you should probably modify your code thusly:

void MyToolbar::ChangeButton()
{
    Glib::ustring str = ICONPATH;
    str += (m_enabled?"Pic2.bmp":"Pic1.bmp");
    m_button.remove();
    m_button.add_pixlabel(str,"");
}

I hope this helps.

Bob



mail gehli com wrote:

>Hi,
>
>I've got the following problem:
>
>I have a MainWindow with a Toolbar, on special Button clicks I change the pixlabel of the 
>Buttons (to indicate the Option is enable or disabled). The buttons are connected to signalhandlers, that hole thing works fine. 
>
>But also the user can start an Optionwindow, it's like a popup dialog (from typ Gtk::Window). And there the user also can change some Options so that I have to update the pixlabels of the buttons too. I tried several things to do this, like call the change Pixlabel function direct or via a dispatcher, but nothing works. I get a Xlib message "Xlib: unexpected async reply" and the button has no pixlabel anymore, and my program crash... How should or how can I do that???
>
>thats my function to change the pixlabel:
>
>void MyToolbar::ChangeButton(){
>	m_Button.remove();
>	
>	if(m_enabled){
>
>		m_Button.add_pixlabel(ICONPATH + "Pic2.bmp","");
>				
>	}
>	else{
>		m_Button.add_pixlabel(ICONPATH + "Pic1.bmp","");
>	}
>
>}
>
>Thanks In Advance!!!
>
>Alex
>
>
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>gtkmm-list mailing list
>gtkmm-list gnome org
>http://mail.gnome.org/mailman/listinfo/gtkmm-list
>  
>



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