double-click

How to bind a command in WPF to a double click event handler of a control?

喜你入骨 提交于 2019-11-27 06:35:37
I need to bind the double click event of a textblock (or potentially an image as well - either way, its a user control), to a command in my ViewModel. TextBlock.InputBindings does not seem to bind correctly to my commands, any help? Kent Boogaart Try Marlon Grech's attached command behaviors . <Button> <Button.InputBindings> <MouseBinding Gesture="LeftDoubleClick" Command="YourCommand" /> </Button.InputBindings> </Button> http://thejoyofcode.com/Invoking_a_Command_on_a_Double_Click_or_other_Mouse_Gesture.aspx Adam it's simple let's use the MVVM way: I'm using here MVVM Light which is easy to

Distinguish between a single click and a double click in Java

浪尽此生 提交于 2019-11-27 04:33:18
I search the forum and see this codes: public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { System.out.println(" and it's a double click!"); wasDoubleClick = true; } else { Integer timerinterval = (Integer) Toolkit.getDefaultToolkit().getDesktopProperty( "awt.multiClickInterval"); timer = new Timer(timerinterval.intValue(), new ActionListener() { public void actionPerformed(ActionEvent evt) { if (wasDoubleClick) { wasDoubleClick = false; // reset flag } else { System.out.println(" and it's a simple click!"); } } }); timer.setRepeats(false); timer.start(); } } but the code

Javafx 2 click and double click

萝らか妹 提交于 2019-11-27 03:53:03
I would like to know if it was possible to detect the double-click in JavaFX 2 ? and how ? I would like to make different event between a click and a double click. Thanks Yes you can detect single, double even multiple clicks: myNode.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){ if(mouseEvent.getClickCount() == 2){ System.out.println("Double clicked"); } } } }); MouseButton.PRIMARY is used to determine if the left (commonly) mouse button is triggered the event. Read the api of

WinForms how to call a Double-Click Event on a Button?

我们两清 提交于 2019-11-27 03:36:18
问题 Rather than making an event occur when a button is clicked once, I would like the event to occur only when the button is double-clicked. Sadly the double-click event doesn't appear in the list of Events in the IDE. Anyone know a good solution to this problem? Thank you! 回答1: No the standard button does not react to double clicks. See the documentation for the Button.DoubleClick event. It doesn't react to double clicks because in Windows buttons always react to clicks and never to double

How can jQuery be used to handle timer in click, dblclick separation

社会主义新天地 提交于 2019-11-27 02:25:09
问题 I am using the jQueryFileTree at http://abeautifulsite.net/notebook/58 and I want to distinguish between the dblclick and click events as a click is always triggered by a dblclick. Googling about led to be a technique in which click is handled by a timer which kicks in when a dblclick does not cancel it. Is there some way this can be used with jQuery and the jQuery example in an elegant manner? 回答1: You can use setTimeout() and clearTimeout() to realize the timer functionality: var timeout;

C# Listbox Item Double Click Event

倖福魔咒の 提交于 2019-11-27 01:00:13
问题 I have a list box with some items. Is there anyway I can attach a double click event to each item? Item 1 Item 2 Item 3 If i was to double click Item 2, a Messagebox saying "Item 2" would pop up How would i do this? 回答1: void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { int index = this.listBox1.IndexFromPoint(e.Location); if (index != System.Windows.Forms.ListBox.NoMatches) { MessageBox.Show(index.ToString()); } } This should work...check 回答2: WinForms Add an event handler

How to execute JAVA program by double clicking on icon?

蹲街弑〆低调 提交于 2019-11-26 23:09:35
I have written a java program. Now I would like to open my console java application without IDE, Eclipse etc., but just by double clicking on the executable version on my Desktop. I have exported the java project in Runnable .JAR file, but it cannot be opened. When I tried to open the application with cmd. java -jar ApplicatonName.jar and everything is fine. But this process is too complicated, and it's not user-friendly. So is there any possible way to do such thing with JAVA ? Thanks in advance :) Create a bat or sh file, depending on the operating system, and put java -jar ApplicationName

Performing a double click using CGEventCreateMouseEvent()

我与影子孤独终老i 提交于 2019-11-26 19:38:05
问题 I'm using the following code to simulate a click of the mouse: void PostMouseEvent(CGMouseButton button, CGEventType type, const CGPoint point) { CGEventRef theEvent = CGEventCreateMouseEvent(NULL, type, point, button); CGEventSetType(theEvent, type); CGEventPost(kCGHIDEventTap, theEvent); CFRelease(theEvent); } void LeftClick(const CGPoint point) { PostMouseEvent(kCGMouseButtonLeft, kCGEventMouseMoved, point); NSLog(@"Click!"); PostMouseEvent(kCGMouseButtonLeft, kCGEventLeftMouseDown, point)

How to stop highlighting of a div element when double-clicking

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 18:58:42
问题 I have this div element with a background image and I want to stop highlighting on the div element when double-clicking it. Is there a CSS property for this? 回答1: The CSS below stops users from being able to select text. Live example: http://jsfiddle.net/hGTwu/20/ -webkit-user-select: none; /* Chrome/Safari */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* IE10+ */ /* Rules below not implemented in browsers yet */ -o-user-select: none; user-select: none; To target IE9

How to prevent a double-click using jQuery?

≡放荡痞女 提交于 2019-11-26 18:00:56
问题 I have a button as such: <input type="submit" id="submit" value="Save" /> Within jQuery I am using the following, but it still allows for double-clicks: <script type="text/javascript"> $(document).ready(function () { $("#submit").one('click', function (event) { Any idea on how I can prevent double-click? 回答1: jQuery's one() will fire the attached event handler once for each element bound, and then remove the event handler. If for some reason that doesn't fulfill the requirements, one could