Data to Callback Functions




Hello

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.

However, this is not working, and when I call the signal by clicking on
the button, the structure is converted to a null pointer by the 
gpointer cast and the screen almost looks like it goes out of scope in the
debugger.

How can I do this other than make the entire structure global?
How can I get a callback fuction to gain access to it's parent
windows and widgets?


Ruben

-- 
__________________________
Brooklyn Linux Solutions

So many immigrant groups have swept through our town 
that Brooklyn, like Atlantis, reaches mythological 
proportions in the mind of the world  - RI Safir 1998

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://fairuse.nylxs.com

http://www.mrbrklyn.com - Consulting
http://www.inns.net <-- Happy Clients
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from around the net
http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn....

1-718-382-0585
____________________________
NYLXS: New Yorker Free Software Users Scene
Fair Use -
because it's either fair use or useless....
NYLXS is a trademark of NYLXS, Inc




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