K
Ken Beauchesne
I have a problem trying to get the OnClick to fire in a listbox,
no matter what method I try to get access to it there is no response.
The doc's say it's supported has anyone had success or can see
what i'm doing wrong?
thanks
Ken
private DisplayListBox.DisplayList DisplayList = new
DisplayListBox.DisplayList();
this.Controls.Add(this.DisplayList);
--------------------------------
list gets filled with items, another event pops up the listbox
and everything is there and when I click on an item the OnClick
never gets called. I use this exact code else where for a non listbox
control and it works perfect.
---------------------------------
namespace DisplayListBox
{
public class DisplayList :System.Windows.Forms.ListBox
{
public delegate void DoubleClickEventHandler( EventArgs e);
public event DoubleClickEventHandler OnDoubleClick;
private int previousClick = SystemInformation.DoubleClickTime + 1;
public DisplayList()
{
this.OnDoubleClick +=new
DoubleClickEventHandler(DisplayList_OnDoubleClick);
this.Location = new Point(200,80);
this.Enabled = true;
this.Visible = false;
}
~DisplayList()
{
}
private void DisplayList_OnDoubleClick(EventArgs e)
{
//
int DisplayIndex;
DisplayIndex = 1; // just for debug never gets here
}
protected override void OnClick(EventArgs e)
{
this.Focus();
int now = System.Environment.TickCount;
if(now - previousClick <= SystemInformation.DoubleClickTime)
{
this.OnDoubleClick(e);
}
previousClick = now;
}
no matter what method I try to get access to it there is no response.
The doc's say it's supported has anyone had success or can see
what i'm doing wrong?
thanks
Ken
private DisplayListBox.DisplayList DisplayList = new
DisplayListBox.DisplayList();
this.Controls.Add(this.DisplayList);
--------------------------------
list gets filled with items, another event pops up the listbox
and everything is there and when I click on an item the OnClick
never gets called. I use this exact code else where for a non listbox
control and it works perfect.
---------------------------------
namespace DisplayListBox
{
public class DisplayList :System.Windows.Forms.ListBox
{
public delegate void DoubleClickEventHandler( EventArgs e);
public event DoubleClickEventHandler OnDoubleClick;
private int previousClick = SystemInformation.DoubleClickTime + 1;
public DisplayList()
{
this.OnDoubleClick +=new
DoubleClickEventHandler(DisplayList_OnDoubleClick);
this.Location = new Point(200,80);
this.Enabled = true;
this.Visible = false;
}
~DisplayList()
{
}
private void DisplayList_OnDoubleClick(EventArgs e)
{
//
int DisplayIndex;
DisplayIndex = 1; // just for debug never gets here
}
protected override void OnClick(EventArgs e)
{
this.Focus();
int now = System.Environment.TickCount;
if(now - previousClick <= SystemInformation.DoubleClickTime)
{
this.OnDoubleClick(e);
}
previousClick = now;
}