Re: [gtk-list] Getting checkbutton's label



Didimo Emilio Grimaldo Tunon <emilio_tunon@nl.compuware.com> writes:
>       I have a series of checkbuttons on my application but I have not
>       found a way of properly/easily identifying them at run time. Yes,
>       sure I can associate a callback to each of them but that seems
>       wasteful. So:
> 
>       	[x] checkbutton-1
> 	[ ] checkbutton-2
>:
> 	[x] checkbutton-n
> 
>      I think I can use a plain value in the signal connect function as the
>      user data but I am not quite sure if it is 'legal' as signal_connect
>      expects a pointer for its last parameter (user data). Perhaps by
>      something like gtk_checkbutton_get_label() (well, this 'method' would
>      be ok at least for debugging).

there's set_data and get_data... But this is absolutely those kind of
data which I'd use user data in gtk_signal_connect()'s last argument.
(for this reason in gtk-- the user data can be of any type..)

>      Most of my checkbuttons do not have a style 'name' associated with
>      them so the name member is 'nil'. So far I use a weird construct of
>      passing a structure as user data and in that structure I have other
>      information, but in the 'extension' I chain the gtk callback with a
>      user callback (ugh! I have my reasons). But then there the user callback
>      has to compare the widget pointer with that contained in a global
>      composite variable (struct) that contains other info. Any ideas for
>      a better implementation?

I'd probably just cast the integer values to void pointers and then back
in the callback...

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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