Hi
I tried make one of my first program with GTK, but I found problem.
I wanted to use g_idle_add, and I need also send to my function
function few informations:
Code:
GtkWidget *box_1, *box_2;
I created structure (Kont) to keep them together.
Code:
struct Kont
{
GtkWidget * kontrolka_1;
GtkWidget * kontrolka_2;
};
....
struct Kont Pudlo={box_1,box_2};
Now I send it to the U_function as a &Pudlo
Code:
lis_idle = g_idle_add ((GSourceFunc) U_function, &Pudlo);
The problem is : outside in main function Pudlo.kontrolka_... has something but
inside U-function I've got nothing. Bud->kontrolka_...=0.
Code:
static gboolean U_function (struct Kont *Bud)
{
....
GtkWindow * dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
"box_1 = %d \n, box_2 = %d \n" ,
Bud->kontrolka_1, Bud->kontrolka_2);
....
}
What is more confusing: on Windows (Dev-C++) all kontrolka=0 but
when I tried to compile this code on linux it works and they have
correct values.
Can anyone tell my why?
Do I make any mistake with structures?
Why windows and linux works different?
Daniel
(full code I can send on request)