bug in radiobutton

"Pedro Cardoso" <[email protected]> Fri, 13 Aug 2004 20:55:59 +0100
Newsgroups gmane.comp.lib.wxwindows.wxnet
Message-ID <[email protected]>
Hi guys, the radiobutton has the same problem that the checlistbox, it
always return the value true :/

Here is a sample code:

using System;
using System.Drawing;
using wx;

namespace WindowsApplication1
{
	public class Form1 : wx.Frame
	{
	
		public const int ID_RADIOBUTTON1	= 1;
		public RadioButton radioButton1;
		public const int ID_BUTTON1	= 2;
		public Button button1;
		public const int ID_RADIOBUTTON2	= 3;
		public RadioButton radioButton2;

		public Form1(string title, Point pos, Size size) :
base(title, pos, size,wx.Window.wxCAPTION|wx.Window.wxCLIP_CHILDREN|
wx.Window.wxMAXIMIZE_BOX| wx.Window.wxSYSTEM_MENU |
wx.Window.wxCLOSE_BOX|wx.Window.wxMINIMIZE_BOX)
		{

			button1=new Button(this, ID_BUTTON1, "button1", new
Point(336, 160), new Size(112, 56));
			button1.Lower();
			radioButton1=new RadioButton(this, ID_RADIOBUTTON1,
"radioButton1", new Point(56, 72));
			radioButton1.Value=false;
			radioButton1.Lower();
			radioButton1.BackgroundColour=new
wx.Colour(System.Drawing.SystemColors.Control.R,System.Drawing.SystemColors.
Control.G,System.Drawing.SystemColors.Control.B);
			radioButton2=new RadioButton(this, ID_RADIOBUTTON2,
"radioButton2", new Point(200, 72), new Size(88, 32));
			radioButton2.Value=false;
			radioButton2.Lower();
			radioButton2.BackgroundColour=new
wx.Colour(System.Drawing.SystemColors.Control.R,System.Drawing.SystemColors.
Control.G,System.Drawing.SystemColors.Control.B);
			this.BackgroundColour=new
wx.Colour(System.Drawing.SystemColors.Control.R,System.Drawing.SystemColors.
Control.G,System.Drawing.SystemColors.Control.B);

			// Bind	events
			EVT_BUTTON(ID_BUTTON1, new
EventListener(this.button1_Click_2));

		}

	


		private void button1_Click_2(object sender, wx.Event e)
		{
	
wx.MessageDialog.MessageBox(radioButton1.Value.ToString(),radioButton2.Value
.ToString(),0,this);
		}
	}


	// Define a	new	application	type, each program should
derive a class from App
	public class MyApp : wx.App
	{

		public override bool OnInit()
		{
			Form1 frame = new Form1("Form1", new Point(50,50),
new Size(538,325));
			frame.Show(true);
			return true;
		}

		[STAThread]
		static void Main()
		{
			MyApp app = new MyApp();
			app.Run();
		}
	}
}





-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285