Re: GtkRadioButton
| From: | steph dot fox at btinternet dot com | Date: | Sat, 01 Jun 2002 13:12:38 +0000 |
| Subject: | Re: GtkRadioButton | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-2074@lists.php.net to get a copy of this message | ||
GTK_STATE_SELECTED from the $widget->state; property any use to you?
There are other ways, but can't think of them off-hand (tool-free weekend).
http://gtk.php.net/manual/en/gtk.enum.gtkstatetype.php
> from: "firepages.com.au" <fire@firepages.com.au>
> date: Sat, 01 Jun 2002 04:43:41
> to: php-gtk-general@lists.php.net
> subject: Re: [PHP-GTK] GtkRadioButton
>
> 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.
>
>
>
>
>
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>