bug on CheckListBox
"Pedro Cardoso" <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.wxnet |
|---|---|
| Message-ID | <[email protected]> |
The ischecked method always returns true ignoring when the item is not
checked
Here is an example
using System;
using System.Drawing;
using wx;
namespace Form1
{
public class MyFrame : wx.Frame
{
public const int ID_CHECKEDLISTBOX1 = 1;
public CheckListBox checkedListBox1;
public const int ID_BUTTON1 = 2;
public Button button1;
public MyFrame(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)
{
Panel panel;
button1=new Button(this, ID_BUTTON1, "button1", new
Point(344, 200), new Size(88, 48));
button1.Lower();
string[] checkedListBox1Items = {"test",
"terwrtew", "trert", "trwertw", "trewtrwrew"};
checkedListBox1=new CheckListBox(this,
ID_CHECKEDLISTBOX1, new Point(216, 56), new Size(216, 94),
checkedListBox1Items);
checkedListBox1.Lower();
checkedListBox1.BackgroundColour=new
wx.Colour(System.Drawing.SystemColors.Window.R,System.Drawing.SystemColors.W
indow.G,System.Drawing.SystemColors.Window.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_1));
}
private void button1_Click_1(object sender, wx.Event e)
{
for (int i=0;i<checkedListBox1.Count;i++)
wx.MessageDialog.MessageBox(checkedListBox1.GetString(i),checkedListBox1.IsC
hecked(i).ToString(),0);
}
}
// Define a new application type, each program should
derive a class from App
public class MyApp : wx.App
{
public override bool OnInit()
{
MyFrame frame = new MyFrame("Form1", new
Point(50,50), new Size(548,331));
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