Re: Data to Callback Functions



Hi,

Ruben Safir Secretary NYLXS <ruben mrbrklyn com> writes:

> I'm trying to write a program for the clinical pharmacy department
> at the hospital.  I hoped to create a top_level window with a vbox.
> The top of the vbox has some buttons and the bottom has a frame.
> Depending on which button is clicked, a different 'form' would
> desplay below.
> 
> In order to do this I created several files, clinical.c clinical.h
> forms.c forms.h calculations.c calculations.h, so I could use the
> calculations for a future project.
> 
> In order to retain access to everything, in fomrs.h I has a struct
> definition struc s1, which has membership of GtkWidgets which I
> hoped to assign to structure instances to pass to callback functions
> attacts as gpoint data, with is the last argument in
> g_signal_connect, such as follows
> 
> g_signal_connect (G_OBJECT (button), "clicked",
>                   G_CALLBACK (lbw_screen), &handle);
> 
> where handle is my structure with the GtkWidgets stored.

It should work that way but unless you show us some more code we
cannot help you to find out why it doesn't work for you. My guess is
that the handle struct is stack-allocated memory at the time you
connect the callback and doesn't exist any longer when the signal is
run. But w/o seeing more code that's just a guess.


Sven



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