Re: Linking button handler to data structure



Tom Jennings wrote:
I'm stumped -- how do I reference the Label text that I know is
attached with the CheckButton widget here?

muppet replied:
GtkCheckButton inherits GtkToggleButton, which is a GtkButton, which is 
a GtkBin, which itself is a GtkContainer with one child.  if i recall 
correctly, the GtkLabel is the child, and the toggle-state stuff is 
handled by custom drawing.

$label = $checkbutton->child;
$text = $label->get;

This of course worked -- I had actually tried this on Friday when
I was stumped, and wrote the list -- I should have taken a coffee
break or something, because the error I was getting was from the
line after those above. D'OH!

So now I have a nice, simple structure -- a loop builds a
scrollable list of CheckButtons and text, and the CheckButton
'clicked' handler common to all buttons can determine which one
was clicked by looking at the button label.


But the result doesn't clarify my task, so I've moved it into a
CList.  But I have a CList question, which I'll post separately :-)




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