Re: Finding which row is selected in a CList

On Thursday 01 January 1970 00:59, you wrote:

My next problem is this. (...)  I have
an interface containing (among other things) two clists, a text box and
a button. What I would like to do is, when the button is clicked, get
the data from the selected rows in both of the clists and use this data
in an sql query, pumping results/errors into the text box. I only know
how to pass one widget in the user_data of signal connects. How do I
access other widgets from the window? I have the gtk+ docs here, but I
am also new to C which doesn't help. Sorry again if this is something
really simple and stupid, I just don't get it ( yet ;-) and need a few

you could make the variables containing the clists and the text box widgets 
global instead of local to the function constructing the clists/text box. 

Alternatively, you could pass a pointer to a structure/array that contains 
the variables with the needed widgets. I'd probably go for the first approach 

in somefile.h:

extern GtkCList *list1;
extern GtkCList *list2;
extern GtkText *textbox;
(of course those could all be GtkWidget * as well instead)

then in somefile.c at the top before any functions start:

GtkCList *list1;
GtkCList *list2;
GtkText *textbox;

my_first_function (void)

etc.. This way every routine in every file can directly access the variables 
list1, list2, and textbox as long as those files have a
#include "somefile.h"
at the beginning.

Hope this helps.


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