Two weired lines are shown (Gtk on DirectFB)
- From: jessonel <jessonel yahoo com>
- To: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: Two weired lines are shown (Gtk on DirectFB)
- Date: Wed, 31 Aug 2011 02:40:13 -0700 (PDT)
Hello,
I'm writing my program with Gtk on DirectFB on ARM9.
GTK: ver 2.12.10
DirectFB: ver 1.0.1
My problem is that two black weired lines are shown when do repeat click of button1, 2.
I don't know why this lines are shown as the attached picture.
My code is as below:
=================================================================
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
GtkWidget *label_num, *label_text;
gboolean on_timer (void *data)
{
gtk_label_set_text(GTK_LABEL(label_num), "0");
gtk_label_set_text(GTK_LABEL(label_text), "Hello");
return true;
}
int main(int argc, char *argv[])
{
GtkWidget *window,*fixed,*image,*button;
GdkColor color = {0, 0x0000, 0x7F00, 0xFF00};
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &color);
gtk_window_resize(GTK_WINDOW(window), 320, 240);
fixed = gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(window), fixed);
image = gtk_image_new_from_file("background.png"); // 320x171 black image
gtk_fixed_put (GTK_FIXED (fixed), image, 0, 45);
gtk_widget_set_usize(GTK_WIDGET(image), 320, 171);
image = gtk_image_new_from_file("part1.png"); // 318x70 white image
gtk_fixed_put (GTK_FIXED (fixed), image, 1, 46);
gtk_widget_set_usize(GTK_WIDGET(image), 318, 70);
image = gtk_image_new_from_file("part2.png"); // 310x91 black image
gtk_fixed_put (GTK_FIXED (fixed), image, 5, 122);
gtk_widget_set_usize(GTK_WIDGET(image), 310, 91);
label_num = gtk_label_new("0");
gtk_fixed_put (GTK_FIXED (fixed), label_num, 15, 65);
gtk_widget_set_usize(GTK_WIDGET(label_num), 101, 44);
label_text = gtk_label_new("Hello");
gtk_fixed_put (GTK_FIXED (fixed), label_text, 119, 80);
gtk_widget_set_usize(GTK_WIDGET(label_text), 73, 22);
button = gtk_button_new_with_label("Button1");
gtk_fixed_put (GTK_FIXED (fixed), button, 9, 125);
gtk_widget_set_usize(GTK_WIDGET(button), 97, 84);
button = gtk_button_new_with_label("Button2");
gtk_fixed_put (GTK_FIXED (fixed), button, 214, 125);
gtk_widget_set_usize(GTK_WIDGET(button), 97, 84);
gtk_widget_show_all(window);
g_timeout_add (500, (GSourceFunc)on_timer, (gpointer) 0);
gtk_main();
return 0;
}
===================================================================
Anybody help me!
Jess
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]