Help removing widgets
- From: Mike <mike geekgene com>
- To: gtkmm-list gnome org
- Subject: Help removing widgets
- Date: Mon, 27 Feb 2006 08:55:22 -0700
Hello,
I can't find very much coverage of how this actually should work, and it's
giving me a lot of troubles. If anyone would help it'd be greatly
appreciated.
I have a program setup with a HPaned in a window. The content in the seccond
panel (the right side) needs to be swapped out for another widget when the
user clicks a button.
So far I have tried several different approaches and no matter what I do it
either crashes, seems to delete the HPaned but keep the left side, or both.
I've been able to reproduce the behaviour in a simpler case using labels:
class MainWnd : public Gtk::Window
{
protected: // Widgets
Gtk::HPaned m_hpMainDiv;
Gtk::Label *m_lRightText;
Gtk::Button m_btnChange;
public:
void on_change()
{
m_hpMainDiv.remove( *m_lRightText );
delete m_lRightText;
m_lRightText = new Gtk::Label("New right text...");
m_hpMainDiv.add2( *m_lRightText );
}
// constructor etc omitted...
};
There we go, on_change is the handler called when you click the button on the
left. I've tried a few different ideas I found searching this mailing list,
including "unparent" and "reference". Nothing seems to help.
Thanks a lot,
--Mike
P.S. I'm having similar difficulty removing pages from a notebook and adding
other pages...this shouldn't be this difficult, I think I'm missing something
fundamental.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]