[Gtk-sharp-list] Using RadioButtons

Jeremiah McElroy jeremiah@facility9.com
Mon, 08 Mar 2004 11:14:20 -0500


Please excuse my ignorance, I just saw ToggleButton.Mode in the 
documentation, and I assume this is what I need.

Jeremiah McElroy wrote:

> Thanks,
>
> I was also looking for an example of how to check with RadioButton in 
> a group is checked.  In SWF you just examine the checked property of 
> the RadioButton, but I can't seem to find that in the monodocs and I 
> was wondering if there was a different property that I should be 
> checking.
>
> Again, thanks,
>
> Jeremiah
>
> Antonio Martínez Álvarez wrote:
>
>> Jeremiah McElroy wrote:
>>
>>> I have an app with a Gtk.Dialog that contains a group of 
>>> RadioButtons.  I would like to use the radio buttons to set a user 
>>> preference in the application.  I can't seem to find any examples 
>>> (in either MS or Mono docs) about how to do this.  If anyone has an 
>>> example or advice, I would greatly appreciate it.
>>
>>
>>
>> This example works for me. I don't know if this is very correct, but 
>> it works:
>>
>> using System;
>> using Gtk;
>> using GtkSharp;
>> class Capp {
>>     Gtk.Window win;
>>     RadioButton rb1,rb2,rb3;
>>     Table t;
>>     Capp() {
>>         win = new Gtk.Window("Trest");
>>         win.DeleteEvent += new DeleteEventHandler(Quit);
>>         t = new Table(3,1, true);
>>         rb1 = new RadioButton(null, "RB 1");
>>         rb2 = new RadioButton(null, "RB 2");               rb3 = new 
>> RadioButton(null, "RB 3");
>>         rb2.Group = rb1.Group;
>>         rb3.Group = rb1.Group;
>>         t.Attach(rb1,0,1,0,1);
>>         t.Attach(rb2,0,1,1,2);
>>         t.Attach(rb3,0,1,2,3);
>>         win.Add(t);
>>         win.ShowAll();
>>     }
>>     static void Main() {
>>         Application.Init();
>>         Capp win = new Capp();
>>         Application.Run();
>>     }
>>     void Quit(object o, DeleteEventArgs a) {
>>         Application.Quit();
>>     }
>> }
>
>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list