How can I draw text correctly in a function?
- From: Jung-Wuk Hong <jwhong MIT EDU>
- To: gtk-app-devel-list gnome org
- Subject: How can I draw text correctly in a function?
- Date: Fri, 10 Nov 2000 14:20:14 -0500
Hi.
Thank you who answered my previous question.
Now I don't have waring (Drawable !=0), but still cannot see the letter
which I
want to draw.
According to advice, I added gtk_widget_realize().
What's wrong in this code. (I can see only button, not text)
Thank you in advance.
J. Hong
/*---------------------------------------------------------
show_property
---------------------------------------------------------*/
void show_property(GtkWidget *was_clicked)
{
GtkWidget *property_window;
GtkWidget *button;
GtkWidget *vbox, *plot_area;
GdkFont *font;
property_window = gtk_window_new (GTK_WINDOW_POPUP); /* make init image
window */
gtk_window_set_position (GTK_WINDOW (property_window), GTK_WIN_POS_CENTER);
gtk_widget_show(property_window);
vbox = gtk_vbox_new(FALSE, NO_SPACING);
gtk_container_add( GTK_CONTAINER( property_window ), vbox );
gtk_widget_show(vbox);
plot_area = gtk_drawing_area_new();
gtk_drawing_area_size( GTK_DRAWING_AREA(plot_area), 300, 200 );
gtk_box_pack_start( GTK_BOX(vbox), plot_area, FALSE, FALSE, NO_PADDING );
gtk_widget_realize(plot_area);
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, 50,50, "abc",15);
gtk_widget_show(plot_area);
button = gtk_button_new_with_label("OK");
gtk_box_pack_start( GTK_BOX(vbox), button, FALSE, FALSE, NO_PADDING );
gtk_widget_show_all(property_window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]