[Mono-bugs] [Bug 424265] New: Nullable DateTimePicker: unchecked checkbox prevents losing focus
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Sep 8 06:03:10 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=424265
Summary: Nullable DateTimePicker: unchecked checkbox prevents
losing focus
Product: Mono: Class Libraries
Version: SVN
Platform: x86
OS/Version: Windows Vista
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Windows.Forms
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: kobruleht2 at hot.ee
QAContact: mono-bugs at lists.ximian.com
Found By: ---
To reproduce:
1. Run code
2. Click in Datetimepicker checkbox to put checkmark
3. Click again to remove check mark
4. Click in TextBox
Observed:
1. TextBox does not receive focus
2. Form does not close
Expected:
1. TextBox should receive focus
2. Form should be closed
Code
using System;
using System.Windows.Forms;
class Test
{
static void Main()
{
Application.Run(new ReportDialogForm());
}
}
class Src
{
public DateTime? Lkuupaev { get; set; }
}
class ReportDialogForm : Form
{
public ReportDialogForm()
{
var tb = new TextBox();
Controls.Add(tb);
var dtp = new MyDateTimePicker();
dtp.Top = 30;
var test = new Src();
BindingSource BindingSource = new BindingSource();
BindingSource.DataSource = test;
BindingSource.ResetBindings(false);
Binding b = new Binding("Value", BindingSource, "Lkuupaev");
b.FormattingEnabled = true;
dtp.DataBindings.Add(b);
Controls.Add(dtp);
}
class MyDateTimePicker : DateTimePicker
{
public MyDateTimePicker()
: base()
{
Format = DateTimePickerFormat.Short;
ShowCheckBox = true;
MinDate = new DateTime(1900, 1, 1);
MaxDate = new DateTime(2900, 1, 1);
}
public new DateTime? Value
{
get
{
if (!this.Checked)
return null;
return base.Value;
}
set
{
if (value != null)
{
base.Value = (DateTime)value;
Checked = true;
}
else
{
base.Value = DateTime.Today.AddDays(1);
base.Value = DateTime.Today;
Checked = false;
}
base.OnValueChanged(EventArgs.Empty);
}
}
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list