Re: how to use get_geometry correctlly



On Tue, 2008-03-25 at 09:08 +0800, chennanbang陳南邦 wrote:
> Hi, all,
> 
> I inherit Gtk::Button, and wonna change the position of my widget
> internally.
> And I use following steps to achieve this, but segmentation fault.
> Please correct me, thanks!
> 
> /* in my widget */
> int x, y, tmp=0;
> get_window()->get_geometry( x, y, tmp, tmp, tmp );// get current
> position, but segmentation fault

you can't do this until the widget has been realized, because before
that time get_window() will return a null (ref) ptr.

put that in the realize handler, or make sure you do it post-realize.

--p




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