Re: resizing a drawingarea



On 04/10/2011 08:03 PM, Robert Pearce wrote:
Hi Kees,

On Sun, 10 Apr 2011 15:54:06 +0200 you wrote:
  In this method I call ste_allocation(allocation) and I check on
several places in my code what the geometry of the widget is and these
are correct, but my drawingArea keeps its orginal  size.
Just to clarify, please:

When you say "these are correct" above, what do you mean? Do you mean
you've formally proved that code, or that you've put in debug printfs
and shown that the geometry found in those places follows the re-sizing
that your drawing area doesn't?

Either way, I think we probably need to see your code. In particular,
how is the drawing area packed? Is it directly in the window? Or is it
nested in something that could be allocating the extra space elsewhere?

Cheers,
Rob
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Hi Rob,

I wrote a small test widget in which you can see the behaviour of the drawingarea. I packed it in a mainwindow by adding it. I also tried to do this with a frame around it and the frame is resizing, but not the drawing area. You can see in the small blue area that the line is changing, so expose works

Here my code:

testArea.h

++++++++++++++++++++++++++++++++++++++++++

#ifndef testArea_H_
#define testArea_H_

#include <gtkmm.h>
#include <iostream>

using namespace std;

class testArea : public Gtk::DrawingArea {

public:
    testArea();
    virtual ~testArea();
private :
    void status();

protected:
    virtual void on_size_request(Gtk::Requisition* requisition);
    virtual void on_size_allocate(Gtk::Allocation& allocation);
    virtual void on_map();
    virtual void on_unmap();
    virtual void on_realize();
    virtual void on_unrealize();
    virtual bool on_expose_event(GdkEventExpose* event);
    virtual bool on_configure_event(GdkEventConfigure* event);

};

#endif /* testArea_H_ */

++++++++++++++++++++++++++++++++++++

testArea.cpp

++++++++++++++++++++++++++++++++++++

#ifndef testArea_H_
#define testArea_H_

#include <gtkmm.h>
#include <iostream>

using namespace std;

class testArea : public Gtk::DrawingArea {

public:
    testArea();
    virtual ~testArea();
private :
    void status();

protected:
    virtual void on_size_request(Gtk::Requisition* requisition);
    virtual void on_size_allocate(Gtk::Allocation& allocation);
    virtual void on_map();
    virtual void on_unmap();
    virtual void on_realize();
    virtual void on_unrealize();
    virtual bool on_expose_event(GdkEventExpose* event);
    virtual bool on_configure_event(GdkEventConfigure* event);

};

#endif /* testArea_H_ */

++++++++++++++++++++++++++++++++++++++++++

Thanks

Kees


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