Newbie question - data with structure



Hi

I tried make one of my first program, but I found problem.
I wanted to use  g_idle_add, and I need also send to my function
function few informations:

#
GtkWidget *box_1, *box_2;
#

I created structure (Kont) to keep them together.

#
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

lis_idle = g_idle_add ((GSourceFunc) U_function, &Pudlo);

The problem is : outside i main function Pudlo.kontrolka_... has something but
inside U-function I've got nothing. Bud->kontrolka_...=0.

#
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?

Daniel


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