mouseevent

How to move items with in VBox(Change order by Dragging) in JavaFX?

谁说我不能喝 提交于 2019-12-03 21:12:09
i want to drag TitledPane with in a VBox.I have n number of Titlepane's in a VBox. I want to change the order of them when dragded.I tried with some of MouseEvents and DragEvents. But its not working for me. But i need the indexes of which Titledpane is moved to which place. Based on that i need to do something in backend. Please help me. Thanks This works for me... private static final String TAB_DRAG_KEY = "titledpane"; private ObjectProperty<TitledPane> draggingTab; @Override public void start(Stage primaryStage) throws Exception { draggingTab = new SimpleObjectProperty<TitledPane>(); VBox

How can I detect a rightmouse button event on mousedown?

岁酱吖の 提交于 2019-12-03 19:50:13
问题 I am updating/debugging and expanding the capabilities of my draggable script and I need to be able to achieve the following result: whatever.onRightMouseButtonMousedown = preventDefault(); I have done a lot of research to no avail, however, I know that it is possible to do this because when I use jquery-ui draggable, it prevents the ability to drag elements when you mousedown with the right mouse button. I want to mimic this ability, and learn how it works so that I can implement it now and

Simulate mouse click in MSPaint

≯℡__Kan透↙ 提交于 2019-12-03 16:46:20
I have a console application which should paint a random picture in MSPaint (mouse down -> let the cursor randomly paint something -> mouse up. This is what I have so far (I added comments to the Main method for better understanding what I want to achieve): [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall)] public static extern void mouse_event(long dwFlags, uint dx, uint dy, long cButtons, long dwExtraInfo); private const int MOUSEEVENTF_LEFTDOWN = 0x201; private const int MOUSEEVENTF_LEFTUP = 0x202; private const uint MK_LBUTTON = 0x0001; public delegate bool

Is accessing the ViewModel in code behind always violating the MVVM pattern?

心已入冬 提交于 2019-12-03 16:39:48
One thing I am really not sure about is how to properly pass mouse events to the ViewModel. There is the way of binding triggers using the interactivity extension like for instance in: WPF event binding from View to ViewModel? But this does not forward the MouseEventArgs to my knowledge, and this solution does not appear very elegant to me. So what would be the proper solution? One way is to register an event and to handle it in the code behind, e.g.: private void ListBox_PreviewMouseDown(object sender, System.Windows.Input.MouseEventArgs e) { var listbox = sender as ListBox; if (listbox ==

Capture mouse clicks on WPF TextBox

三世轮回 提交于 2019-12-03 14:33:39
问题 I want to capture mouse clicks on a TextBox : <Window x:Class="WpfApplication2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <TextBox x:Name="t" MouseDown="TextBox_MouseDown" MouseLeftButtonDown="TextBox_MouseLeftButtonDown" MouseLeftButtonUp="TextBox_MouseLeftButtonUp" Height="50" /> </Grid> </Window> Now I only receive a mouse click event when the user first

WPF - Detect mouse down for a set period of time

旧城冷巷雨未停 提交于 2019-12-03 14:01:35
what's the best way to detect when a mouse button has been held down on a particular element for a specific period of time? Guy You need to add MouseDown and MouseUp handlers to the object. In the MouseDown record DateTime.Now . If in the MouseUp handler: DateTime.Now.Subtract(clickTime).TotalSeconds > your_seconds_value then fire a new event MouseClickedForXseconds . If you don't want to wait for a mouse up event then you need to start a timer on the MouseDown method which fires your MouseClickedForXSeconds event. This timer will be canceled by a mouse up event. Thanks for the tip, I've made

Simulate a physical mouse move in Mac OS X

半世苍凉 提交于 2019-12-03 12:51:11
I'm looking for a way to simulate a mouse move event in Mac OS X 10.6. It would have to be defined in mouse units (rather than pixels — that is important!) I need this for an experiment which basically consists of drawing lines. Any ideas are welcome. Thank you! One of the easiest ways to move the mouse in Mac OS X and other operating systems is to use a Java Robot . It can also simulate other events. For example, the mouse down or even a key press. However, it moves the pointer to a given screen coordinates. So the only thing you need to do is to convert your physical units into appropriate

Angular2: mouse event handling (movement relative to current position)

烈酒焚心 提交于 2019-12-03 11:40:46
问题 My user should be able to move (or rotate) an object by mouse in a canvas. When mouse events occur the screen coordinates are used to calculate the delta (direction and length) to the last event. Nothing special... mousedown (get the first coordinate) mousemove (get nth coordinate, calculate deltaXY, move object by deltaXY) mouseup (same as step 2 and stop the mousemove and mouseup event handling) After this chain of events it should be possible to repeat the same action. This outdated

MouseDoubleClick events don't bubble

与世无争的帅哥 提交于 2019-12-03 11:19:28
问题 My scenario, simplified: I have a ListView containing rows of Employees, and in each Employee row, there are buttons "Increase" and "Decrease" adjusting his salary. Pretend that in my program, double-clicking an Employee row means "fire this person". The problem is that while I'm clicking "Increase" rapidly, this triggers a double click event on the ListViewItem. Naturally, I don't want to fire people when I'm just increasing their salary. According to how all other events work, I expect to

execute Jquery when the mouse stops moving

南楼画角 提交于 2019-12-03 06:50:45
I have a quick script that has a trail follow the cursor: jQuery(document).ready(function(){ $(document).mousemove(function(e){ $('.fall').each(function(){ if ($(this).css("opacity") == 0){ $(this).remove(); }; }); t = (e.pageY - 10).toString() + 'px'; l = (e.pageX - 10).toString() + 'px'; $('.fall').css("margin_left",l); $('.fall').css("margin_top",t); var doit = '<div class="fall" style="position:fixed;margin-left:' + l + ';margin-top:' + t + ';">+</div>' $('body').prepend(doit); $('#status2').html(e.pageX +', '+ e.pageY); $('.fall').animate({ marginTop: '+=50px', opacity: 0 },1000); }); });