View previous topic :: View next topic |
Author |
Message |
joshua
Joined: 21 May 2008 Posts: 2 Location: Poland
|
Posted: Wed May 21, 2008 2:39 pm Post subject: how to handle mouse click events on dfl.button.Button? |
|
|
Could anyone pass a code that shows how to handle right-click and middle-click mouse events on a button?
Code: |
import dfl.all;
class MyForm: dfl.form.Form
{
dfl.button.Button myButton;
this() {
myButton = new dfl.button.Button();
myButton.text = "Click me";
myButton.click ~= &clickedLeft; // connects left-click event
myButton.parent = this;
}
private void clickedLeft(Control sender, EventArgs ea) {
msgBox("clicked LEFT mouse button");
}
// Where to plug this function?...
// private void clickedRight(Control sender, EventArgs ea) {
// msgBox("clicked RIGHT mouse button");
// }
}
void main() {
Application.run(new MyForm());
}
|
Maybe button is not the best choice for right-click events, but I need a buttonlike functionality in overall... |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Wed May 21, 2008 10:07 pm Post subject: Re: how to handle mouse click events on dfl.button.Button? |
|
|
click is specifically for left clicks, but you can use mouseDown and test for the right button. |
|
Back to top |
|
|
joshua
Joined: 21 May 2008 Posts: 2 Location: Poland
|
Posted: Thu May 22, 2008 4:18 am Post subject: |
|
|
Simplicity is bless...
Yeap. That's it. Thanks Chris. |
|
Back to top |
|
|
|