Re: set state of radio button
| From: | Arnd Vehling | Date: | Tue, 09 Sep 2003 09:52:55 +0000 |
| Subject: | Re: set state of radio button | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3845@lists.php.net to get a copy of this message | ||
Hello,
Charles McLaughlin wrote:
Is it possible to select a radio button via a script?You mean changing the state of a GtkOption Menu from outside the php-gtk program?
I need a function that can set a radio button to it's selected state, or de-select it.AFAIK there are no php-gtk built in function for this. If you really need to do this, heres an suggestion: Define a filehandle from which your php-gtk application reads something, like a string or a number (could be index to the OptionMenu). If your script needs to change the button it writes to the filehandle. Your php-gtk script now gets input from the filehandle, reads it and adjust the OptionMenu like requestet. The only problem may be to code this asynchronous, like having a php function which is only triggered when theres something to read from the filehandle. Like binding a function to a "file-handle-input" event, if u know what i mean. Ive programmed something similiar in C/Xlib some years ago but i dont know how to do this with php-gtk (yet). This probably requires beeing able to modify the event-loop of gtk::main. As an alternative you could use the php-gtk timer functions gtk::timeout_add gtk::timeout_remove This way you could check the status of the filehandle periodically. The nice aspect of this solution is that the "filehandle" could be a network socket and therefore you could change the status of OptionMenus from any network location with a ip connection to the maschine running the php-gtk application. best regards, Arnd