Re: "undrawing" a line
- From: Pavel Cisler <pavel eazel com>
- To: Davina Armstrong <davina lickey com>
- Cc: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>, gtk-list gnome org
- Subject: Re: "undrawing" a line
- Date: Mon, 04 Dec 2000 18:27:08 -0800
Davina Armstrong wrote:
I posted earlier that I was trying to draw decorations around a GtkLabel
(which is actually part of a composite widget I wrote that packs a
GtkLabel and GtkEntry into a GtkHBox), which I've done successfully -
thanks. The idea is that I want the decorations to be drawn when
MyWidget gets focus, and "undraw" them when it loses the focus. I wrote
the following draw_focus function, which is called from
my_widget_focus_in() and my_widget_focus_out():
static void my_widget_draw_focus(GtkWidget* widget)
{
g_return_if_fail(widget != NULL);
g_return_if_fail(IS_MY_WIDGET(widget));
if (GTK_WIDGET_HAS_FOCUS(widget)) {
/* draw the decoration */
} else {
gtk_widget_draw(widget, NULL);
}
}
The decorations draw when MyWidget gets focus, but don't go away when it
loses the focus. I've verified that gtk_widget_draw() is being called.
Can anyone tell me what I'm doing wrong?
Thanks!
Davina
Davina,
My guess is that the extra decorations don't go away because the
gtk_widget_draw doesn't erase any of the backgrounds your decorations
are drawn on -- they normally come erased for you in the exposure
callback. You could easily verify this by de-focusing your widget and
causing it to redraw by invalidating it by another window. The part that
you invalidate should redraw without the decorations.
Pavel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]