Ma lin wrote:
thanks for you help, before the description is not very accurate,
gtk: gtk+-2.10.14
directfb : DirectFB-1.0.0 (with intel gdl as gfxdriver)
cairo: cairo-1.4.2
pango: pango-1.16.2
cpu: intel Olo
I used gtk_label_set_label to change my label text in my button click
callback,
but string(old one) not clear , so new one was over old one.
and I found that new one just cover old one if font width not change,
otherwise, old one could be show ether.
I have no ideal ,it's pango layout bugs or something else?
thanks for help
The code appears to function without problem on GTK/X11. Must be a
problem specific to pango on directfb. I'm preserving the code below,
so that the other people on the list might take a look.
Michael
example code:
#include gtk/gtk.h
GtkWidget *label;
static void hello( GtkWidget *widget,
gpointer data )
{
gchar buffer[10] = {'\0'};
static int index=0;
index ++;
switch (index)
{
case 1:
strcpy (buffer, really);
break;
case 2:
strcpy (buffer, cover);
break;
case 3:
strcpy (buffer, right);
break;
default:
break;
}
if (index =3)
index = 0;
gtk_label_set_text (GTK_LABEL(label), buffer);
g_print (Hello World\n);
}
static gboolean delete_event( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
g_print (delete event occurred\n);
return FALSE;
}
static void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();
}
int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *box;
gtk_init (argc, argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (window, 485, 108);
g_signal_connect (G_OBJECT (window), delete_event,
G_CALLBACK (delete_event), NULL);
g_signal_connect (G_OBJECT (window), destroy,
G_CALLBACK (destroy), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
box = gtk_hbox_new (TRUE, 0);
button = gtk_button_new_with_label (Hello World);
g_signal_connect (G_OBJECT (button), clicked,
G_CALLBACK (hello), NULL);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
label = gtk_label_new (hello world);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list