mouseevent

Change style of surrounding border on mouse over

邮差的信 提交于 2019-12-03 06:01:23
问题 I have a Grid with a Border around it. Upon mouse over on the Grid , I want to change the style on the Border . How would I go about doing this? This is what I've tried, without any success so far: <Border Name="Border" BorderBrush="Transparent" BorderThickness="1" CornerRadius="2"> <Grid> <Grid.Style> <Style TargetType="{x:Type Grid}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="Border" Property="BorderBrush" Value="#FFB9D7FC" /> </Trigger> </Style

Capture mouse clicks on WPF TextBox

我的未来我决定 提交于 2019-12-03 04:20:57
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 enters the TextBox . After this TextBox has keyboard focus, I do not receive mouse click event anymore.

How Do I Use SendInput in Delphi?

对着背影说爱祢 提交于 2019-12-03 03:55:11
I was using the Mouse_Event Function in Delphi 2009, but the Delphi documentation says this function has been superceded and to use SendInput instead. The Delphi SendInput documentation defines the syntax and parameters, but there are no examples and it is not clear how to use the function. I've looked around on the web, and can't find any good Delphi examples. Specifically, I am trying to simulate the left mouse down and then up. Currently I do this with Mouse_Event as follows: Mouse_Event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); Mouse_Event(MOUSEEVENTF_ABSOLUTE or

JavaScript click handler not working as expected inside a for loop [duplicate]

耗尽温柔 提交于 2019-12-03 02:29:33
问题 This question already has answers here : How do JavaScript closures work? (86 answers) Closed 5 years ago . I'm trying to learn JS and got an issue. I tried many things and googled but all in vain. Following piece of code doesn't work as expected. I should get value of i on click but it always returns 6. I'm pulling my hair out., please help. for (var i = 1; i < 6; i++) { console.log(i); $("#div" + i).click( function() { alert(i); } ); } jsfiddle 回答1: Working DEMO This is a classic JavaScript

change cursor to finger pointer

我只是一个虾纸丫 提交于 2019-12-03 02:29:04
问题 I have this a and I don't know that I need to insert into the "onmouseover" so that the cursor will change to finger pointer like a regular link: <a class="menu_links" onclick="displayData(11,1,0,'A')" onmouseover=""> A </a> I read somewhere that I need to put: onmouseover="cursor: hand (a pointing hand)" But it's not working for me. Plus I'm not sure if this is considered JavaScript, CSS, or just plain HTML. 回答1: <a class="menu_links" onclick="displayData(11,1,0,'A')" onmouseover="" style=

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

自闭症网瘾萝莉.ら 提交于 2019-12-03 02:10:27
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 example works as expected, after removing the toRx calls. But here the delta to the first coordinate is

WPF how do I create a textbox dynamically and find the textbox on a button click?

眉间皱痕 提交于 2019-12-03 01:56:08
I am creating a TextBox and a Button dynamically using the following code: Button btnClickMe = new Button(); btnClickMe.Content = "Click Me"; btnClickMe.Name = "btnClickMe"; btnClickMe.Click += new RoutedEventHandler(this.CallMeClick); someStackPanel.Childern.Add(btnClickMe); TextBox txtNumber = new TextBox(); txtNumber.Name = "txtNumber"; txtNumber.Text = "1776"; someStackPanel.Childern.Add(txtNumber); I hook up to a click event to the Click Me button. The click me button even is fired correctly. However I cannot find the TextBox I entered dynamically. Here is my click me event: protected

MouseDoubleClick events don't bubble

你。 提交于 2019-12-03 01:40:16
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 be able to solve this by setting Handled=true on the event. This, however, doesn't work. It appears to

Is there a way to make controls transparent to mouse events in WPF?

雨燕双飞 提交于 2019-12-03 00:56:30
Is there a way that I can let mouse events pass through to controls behind? Rachel Sure, just set IsHitTestVisible="False" on the control. Mouse events will pass through it. I usually solve these kind of issues by adding handlers of child controls to the parent at construction. This way the 'click'-event for example activates a method that raises the 'click'-event of the parent. 来源: https://stackoverflow.com/questions/4226770/is-there-a-way-to-make-controls-transparent-to-mouse-events-in-wpf

Smooth vertical scrolling on mouse wheel in vanilla javascript?

假装没事ソ 提交于 2019-12-03 00:19:19
I am a huge fan for vanilla javascript, currently I am working on a project where I need to implement smooth scrolling on mouse wheel scroll. I want to implement this using vanilla JS. I found a jQuery snippet on doing some research which go like below. $(window).on('mousewheel DOMMouseScroll', function(e) { var dir, amt = 100; e.preventDefault(); if(e.type === 'mousewheel') { dir = e.originalEvent.wheelDelta > 0 ? '-=' : '+='; } else { dir = e.originalEvent.detail < 0 ? '-=' : '+='; } $('html, body').stop().animate({ scrollTop: dir + amt },500, 'linear'); }); Can anyone help me out as in how