dsimcha
Joined: 24 Oct 2008 Posts: 16
|
Posted: Wed Jul 14, 2010 10:35 pm Post subject: Control Events |
|
|
The double-click event in the following code does not work. When the area the Foo control occupies is double-clicked, nothing happens.
Code: | import dfl.all;
class Foo : Control {
PictureBox pbox;
this() {
pbox = new PictureBox;
this.size = Size(800, 600);
pbox.setBounds(0, 0, 800, 600);
pbox.parent = this;
}
}
class MyForm : Form {
void fooEvent(Control c, EventArgs ea) {
msgBox("You double clicked.");
}
Foo foo;
this() {
foo = new Foo;
foo.parent = this;
foo.doubleClick ~= &fooEvent;
}
}
void main() {
Application.run(new MyForm);
} |
However, when I change:
Code: | foo.doubleClick ~= &fooEvent; |
to
Code: | foo.pbox.doubleClick ~= &fooEvent; |
then double-clicking in the area occupied by the Foo control produces the intended result. Can someone please explain this behavior to me? |
|