Re: [gtkmm] Gtk::Button.set_flags() && GTK_WIDGET_SET_FLAGS ( widget , GTK_CAN_DEFAULT)



Mirco Antonio Coralles <noche suapie reflex at> writes:

> BuggyWindow::BuggyWindow() : m_Button("Don't click me !")
> {
> 	set_title("My Buggy Window");
> 	
> 	m_VBox.pack_start(m_TextView);
> 	m_VBox.pack_start(m_Entry);
> 	m_VBox.pack_start(m_Button);
> 	
> 	/*GTK_WIDGET_SET_FLAGS (m_Button , GTK_CAN_DEFAULT);    		
> compile-time error: cannot convert
>            `this->BuggyWindow::m_Button' from type `
>        	Gtk::Button' to type `GTypeInstance*' */

To use GTK+ call directly, you need to call m_Button.gobj().

> 	m_Button.set_flags(CAN_DEFAULT);  /*-> runtime error:  			 	
> Gtk-WARNING **: gtkwidget.c:3571: widget not within a 				GtkWindow &&
> doesn't work */

You haven't added the m_VBox (argh, finger-hurting hungarian camel
notation) to your window yet. So m_Button isn't within a window when
you are calling set_flags. Try moving the line

  add(m_Vbox);

up before this call. :-)

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/



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