Re: About Gtk::Bin?



I searched our mailing list , and found some one encountered the same
problem , but no solution found. Why?

On Sun, Dec 14, 2008 at 11:28 AM, BC Zhu <zhubicen gmail com> wrote:
> Yes. Following code still can work.
> #include <gtkmm.h>
>
> class Viewer : public Gtk::HBox
> {
>  private:
>   Gtk::Table table_;
>   Gtk::Button button_;
>
>  public:
>   Viewer() : table_(2, 2), button_("ZHU")
>   {
>     table_.attach(button_, 0, 1, 0, 1);
>     pack_start(table_);
>     show_all();
>   }
> };
>
> class Window : public Gtk::Window
> {
>  private:
>   Viewer viewer_;
>
>  public:
>   Window()
>   {
>     add(viewer_);
>     viewer_.show();
>
>   }
> };
>
> int main (int argc,char *argv[])
> {
>   Gtk::Main kit(argc, argv);
>   Window win;
>   kit.run(win);
>   return 0;
> }
>
>
> On Sun, Dec 14, 2008 at 5:49 AM, Robert Pearce <rob bdt-home demon co uk> wrote:
>> Hi Simon,
>>
>> On Sat, 13 Dec 2008 15:54:13 +0100 you wrote:
>>> Actually, I have no idea why it does not work. Seems to be a problem
>>> with the Gtk::Bin. I replaced it with a Box and it worked.
>>>
>>
>> I've seen one change between your two posted versions that would explain it. In the working one you have:
>>
>>> class Window : public Gtk::Window
>>> {
>>>   public:
>>>     Window()
>>>     {
>>>       add(viewer_);
>>>       show_all();
>>>     }
>>> };
>>
>> Whereas the original had:
>>
>>> >>> class Window:public Gtk::Window
>>> >>> {
>>> >>> public:
>>> >>>     Window(){
>>> >>>         add(viewer_);
>>> >>>         viewer_.show();
>>> >>>     }
>>> >>> };
>>
>> Comparing these extracts you'll note that the original only showed the viewer, and not the window itself, while the new version shows "all", meaning the window and all its children.
>> _______________________________________________
>> gtkmm-list mailing list
>> gtkmm-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>>
>
>
>
> --
> Best Regards
> Bicen Zhu
>



-- 
Best Regards
Bicen Zhu


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