Re: Problem with the expose-event



Hi..

The expose event happens quite often. Whenever a part of the screen has
to be redrawn. I think what you are looking for is on_configure_event.
This event only happens if the drawing area is re sized.

I would recommend that you draw all your graphics to a pixmap in your
on_configure_event and then use on_expose to draw the pixmap to the
drawing area.

Here is my expose code. back is the pixmap:

bool GtkStaff::on_expose_event(GdkEventExpose *event)
{
    int width = get_allocation().get_width();
    int height = get_allocation().get_height();

    if(back)
    {
        Glib::RefPtr<Gdk::GC> gc = Gdk::GC::create(get_window());
        Gdk::Rectangle rec(0,0, width, height);
        gc->set_clip_rectangle(rec);
        get_window()->draw_drawable(gc, back, 0, 0, 0, 0);
        gc.clear();
    }

    return false;
}

On 8/9/2005, "Simith Nambiar" <simith openeratech com> wrote:

>Hi All,
>                  I have a problem with the expose-event getting called for
>my Drawing Area continiously.
>Here is what i'am doing , i have 3 Drawing Areas in a Horizontal box of a
>Window.
>
>I have set the same expose handler for all of the drawing areas, when the
>program starts the Expose Event handler ,
>would pick up the  user data , and then , find out the image to be
>displayed.
>
>I expect it to be called 3 times when the program comes up , but i see it
>happenning continiously.
>I connect to the Linux system where i run the program through a Vnc Client .
>
>Anyone has faced a similar problem or any suggestions welcome.
>
>Thank you.
>
>Cheers,
>Simith Nambiar
>



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