RE: Help me about this "drawable" error

I think you need to realize the drawing area widget before you can draw on it.
Try gtk_widget_realize(GTK_WIDGET(plot_area)) before you make your call to
gdk_draw_text().  Hope this helps.

                                -- Stupid Genius

From:         Jung-Wuk Hong[SMTP:jwhong MIT EDU]
Sent:         Friday, November 10, 2000 5:11 AM
To:   gtk-app-devel-list gnome org
Subject:      Help me about this "drawable" error


I wrote a function to write text on popup window. However it doesn't work
I met the error drawable!=NULL.
Please help me about this problem.

In main.c, this callback is connected like this "gtk_signal_connect( button1,
"clicked", show_property, NULL);

Although I could see the button generated in this callback....


J. Hong

void show_property()
  GtkWidget *property_window;
  GtkWidget *button;
  GtkWidget *vbox, *plot_area;
  GdkFont *font;

  property_window = gtk_window_new (GTK_WINDOW_POPUP); /* make init image
window */
  plot_area = gtk_drawing_area_new();
  button = gtk_button_new_with_label("OK");

  gtk_drawing_area_size( GTK_DRAWING_AREA(plot_area), 300, 200 );
  vbox = gtk_vbox_new(FALSE, NO_SPACING);

  gtk_window_set_position (GTK_WINDOW (property_window), GTK_WIN_POS_CENTER);

  font = gdk_font_load ("-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*");

  gdk_draw_text(GTK_WIDGET(plot_area)->window, font, 
                GTK_WIDGET(plot_area)->style->black_gc, 10,10, "abc",15);

  gtk_box_pack_start( GTK_BOX(vbox), plot_area, FALSE, FALSE, NO_PADDING );
  gtk_box_pack_start( GTK_BOX(vbox), button, FALSE, FALSE, NO_PADDING );
  gtk_container_add( GTK_CONTAINER( property_window ), vbox );

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

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