Re: Howto set maximum window size ?



Nil Gradisnik wrote:

"add a handler for the realize event, and do this there."
hmm... how ? :)

How do I fix this, how do I realize window.
I really need some example code to get this.. I'm still learning gtkmm.

On 6/1/05, *Paul Davis* <paul linuxaudiosystems com <mailto:paul linuxaudiosystems com>> wrote:

    >set_geometry_hints(???, geometry, Gdk::HINT_MAX_SIZE);
    >.
    >.
    >.
    >
    >Now I don't know what to use here, the "window.gobj()" is clearly
    not=20
    >working.

    you can't do this until the widget (main window) has been
    realized. until that time, its just a data structure in your
    program -
    the X server doesn't know anything about it and no window actually
    exists.

    add a handler for the realize event, and do this there.

    --p


Add a function to your derived class called "Sysinfo::on_realize". In that function make the calls you were trying to make in the constructor, ala

   void Sysinfo::on_realize(void)
   {
       Gdk::Geometry geometry;
       geometry.max_height = 800;
       geometry.max_width = 600;
       set_geometry_hints(this->gobj(), geometry, Gdk::HINT_MAX_SIZE);
   }

Then, in your constructor itself include the following line:

   signal_realize().connect(sigc::mem_fun(*this, &Sysinfo::on_realize));

Thus your geometry settings function will be called *after* the window is realized thereby allowing the gobj() call to proceed normally.

Sincerely,
Bob Caryl



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