Re: GtkRadioButton
| From: | firepages.com.au | Date: | Sat, 01 Jun 2002 03:43:41 +0000 |
| Subject: | Re: GtkRadioButton | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2073@lists.php.net to get a copy of this message | ||
OK trying another approach here - but I think my lack of OOP is shining
through ;)
<?
class checkbuts extends GtkHbox{
var $click_sel;
function checkbuts($desc,$array,$lw,$lh){
$this->GtkHbox(false,3);
$this->click_sel='33';
$but = &new GtkRadioButton(null,$array[0]);
$but->connect_object('clicked',create_function('$obj','$obj->click_sel=1;ech
o $obj->click_sel;'),&$this);
$but1 = &new GtkRadioButton($but,$array[1]);
$but1->connect_object('clicked',create_function('$obj','$obj->click_sel=2;ec
ho $obj->click_sel;'),&$this);
$but->set_usize(20,20);$but1->set_usize(20,20);
$label=&new
GtkLabel($desc);$label->set_usize($lw,$lh);$label->set_justify(GTK_JUSTIFY_L
EFT);
$this->add($label);$this->add($but);$this->add($but1);
}
function check_state(){
echo $this->click_sel;
var_dump($this);
}
}
/*assuming*/
$test=&new checkbuts('label',array('yes','no'),200,25);
/*then later in another function*/
function whatever($test){
$test->check_state():
}
/*just returns the value '33' which is set in the constructor, but is
supposed to change when one of the checkbuttons was clicked..
indeed when clicking on the checkbuttons the 'new' value is echoed to screen
although $this->click_sel is obviosly not getting set in this instance
*/
sorry if this is OT but I kinda get blank stares from the usual forums &
lists when it comes to GTK...
Regards
Simon Wheeler
----- Original Message -----
From: "firepages.com.au" <fire@firepages.com.au>
To: <php-gtk-general@lists.php.net>
Sent: Friday, May 31, 2002 1:20 AM
Subject: [PHP-GTK] GtkRadioButton
HI - I see in the manual the way to grab the label of a radio button, but
can I find out from elsewhere the current state of a given radio button...
function is_selected($button,$radio_button){
$temp= $radio_button->child; /* just gives me the button label */
}
/*another button somewhere*/
$yak=&new gtkbutton('adsfafdadsf');
$yak->connect('clicked','is_selected',$radio_button);
I want to find out if the radio button has been selected or not & have not a
clue how (as usual)
Regards,
Simon Wheeler
firepages.