Re: [gtkmm] configure_event in drawing area
- From: Daniel <dss home se>
- To: Tassos Bassoukos <abas aix meng auth gr>
- Cc: pbd op net, gtkmm-list gnome org
- Subject: Re: [gtkmm] configure_event in drawing area
- Date: Sat, 14 Sep 2002 14:56:26 +0200
> AFAIK, GtkNotebook will only realize widgets that are to be shown, in
> order to speed up the display of the whole widget[1]. This would lead to
> the problem you seem to have, as on_configure_event will only be called
> *after* you click on the "Drawing Area" tab.
>
Yes this is my problem. I want to be able to draw to the pixmap before it is shown to the user for the first time (think about a couple of different plots in a notebook, the user might or might not look at all of them). I would like to modify my code so that I can draw to the pixmap before on_configure_event...
> If the drawing you have to perform in add_line is relatively light, you
> could perform it directly in the expose handler. If it is computationally
> intensive, you should set some defaults (for example in the default size
> of the draing area) and create your pixmap based on them.
>
I want to draw to the pixmap in the add_line-functions since it depends on pretty heavy calculations (an external program is executed and data is read from a file).
> If the user resizes the window, the pixmap will be recreated, losing all
> its contents. Are you prepared to redraw all the pixmap contents?
>
> As an aside note, if you want to receive Expose events on the drawing
> area, you will need to modify your constructor to be
> MyDrawingArea() {add_events(Gdk::EXPOSURE_MASK);};
>
I used a drawingarea in several applications without this. Why is this important? Shouldn't it be in the example then?
> Also, note that many of the default GCs will not do what you want, as they
> will be set/modified by themes.
>
> Also, consider initializing the newly created pixmap to some color, as
> it may contain junk.
>
The attached file was just an example to illustrate the segfault. However, the GC-initalization stuff is from my program. I would like to do this the proper way but it is difficult to find information on how to do this.
/Daniel
> Tassos
> [1] Note that notebooks are notorious for having many subwidgets, think
> property dialogs or preferences.
>
> --
> Bassoukos Tassos +30 31 996011 / +30 93 7109954 IT Generalist
>
> Unix: Your gun, Your bullet, Your foot, Your choice.
> M$-CE/ME/NT: Same as Unix, BUT: No choice, and We Aim Higher.
> -- From the Linux S/390 mailing list
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]