w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
jquery mouse over and out event firing when mouse is moved quickly over image
I think it would be better to use .mouseenter(). In that case you just get 1 event, while with mouseover you get many. So your code could be: $(document).ready(function() { $("#icon").mouseenter(function() { $(this).fadeOut(1000); }).mouseout(function() { $(this).fadeIn(1000); }); }); You could also do this just with CSS: #icon { transition: opacity 1s; } #icon:hover { opacity:0; } <img src="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon@2.png?v=fde65a5a78c6" id="icon" alt="" />

Categories : Jquery

How to tell if mouse moved during .click()?
Keep track of the mouse position between mousedown and mouseup to see it the mouse pointer moved. You should probably add a little margin of error, like a few pixels every way, but below is a simplified example : var left = 0, top = 0; $(element).on({ mousedown: function(e) { left = e.pageX; top = e.pageY; }, mouseup: function(e) { if (left != e.pageX || top != e.pageY) { alert(' OMG, it moved ! '); } } });

Categories : Jquery

ShowCursor has no effect until the mouse is moved
If I understand correctly how cursor work in Windows, you have to call SetCursor(IDC_...) to make the cursor visible immediately. The thing is that the cursor usually set from the window beneath, as a response to message WM_SETCURSOR. The idea of ShowCursor() is that it disables/enables the WM_SETCURSOR message. When disabling the cursr it also does SetCursor(NULL) so that the cursor dissapears. But when enabling the cursor it cannot call SetCursor(IDC_...) because it does not know which cursor should be shown. So it waits until the next WM_SETCURSOR is generated, that it until the mouse is moved.

Categories : C++

Jemmy drag and drop blocks until mouse manually moved
There is an issue RT-25057 in product which prevented jemmy from correctly using drag-and-drop on some platforms. I'm afraid for now you need to use a workaround using mouse move and press/release: rows[0].mouse().move(); rows[0].mouse().press(); Point from = rows[0].wrap().getClickPoint(); Point to = target.getClickPoint(); int steps = 10; for(int i = 1; i<= steps; i++) { rows[0].mouse().move(new Point( from.x + i*(to.x - from.x)/steps, from.y + i*(to.y - from.y)/steps)); } rows[0].mouse().release();

Categories : Testing

NSTextView not dealloc'd until mouse moved (trashing Undo Stack?)
Still don't know why NSTextView deallocation is deferred - but it turns out that was a red herring anyway. The reason my undo stack was getting trashed was because I was destroying my NSTextView inside my textDidChange callback (albeit with a retain/autorelease to defer the actual dealloc.) If I defer my destroyTextView: code by calling it by performSelector:withObject:afterDelay from my textDidChange then all is well (with the undo stack.) Makes sense now I've found the reason...doesn't it always?

Categories : Osx

PySide Button Auto Repeat doesn't start until mouse is moved
I was having a similar problem using normal QT4.x on linux. The issue was that something was connected to the clicked signal. I think it was stealing/changing the focus of the mouse. I just changed that item to connect to the the released signal. That doesn't mean you can't connect to clicked, but just be sure that there are no focus stealing side-effects.

Categories : Python

Determining when a WPF window is being moved
wont Window.LocationChanged event help you in this case. http://msdn.microsoft.com/en-us/library/system.windows.window.locationchanged.aspx

Categories : C#

window.focus to bring main window in front of popup
According to that post, window.focus() won't work on Chrome because it is disabled. It might be the same for Safari.

Categories : Javascript

WPF - Do controls in a window automatically set the window's focus to themselves when clicked on?
If you use standard controls like Button or TextBox the Focus is set automatically. If you're inventing your own controls (and don't do so by building them with the standard controls) you might have to implement the focus yourself.

Categories : Wpf

Can't seem to adapt window.focus and window.onblur to my situation
Your current process looks like this: An ajax request succeeds. 15 seconds later, setTimeout creates two event handlers to listen for window.focus (which should be window.onfocus) and window.onblur. In the same setTimeout call, the value of isActive is checked, and it's undefined. Since the script hasn't had time to listen for the focus or blur events -- as they were created earlier in the same setTimeout statement -- that means isActive hasn't been given a value. Your variable isActive, as well as the function, should be declared separately and globally: var isActive = true; window.onfocus = function () { isActive = true; }; window.onblur = function() { isActive = false; }; Then, use your timeout like so: // Ajax request succeeds above setTimeout(function() { if (!is

Categories : Javascript

WPF window should not be moved,resized and should only contain minimize,close buttons
In order to touch the titlebar of the window you will have to import user32 APIs as described in this answer: Disable Minimize Button, but Keep Cross and Maximize Buttons - WPF, C# Also you can set the ResizeMode to CanMinimize. This will disable the maximize button. But in order to hide it you will have to use user32 apis as described above

Categories : Wpf

Calling Focus on textbox in window 'x' causes the window 'x ' to be top most
I believe that this is the normal focus behaviour. If you were to manually click in the TextBox to focus it, that window would become the focused window. There are a few things that you could try to get around this. Have you tried setting ErrorWindow.TopMost = true and MainWindow.TopMost = false? You could try displaying the errors in the first window instead... the users would probably prefer this too.

Categories : Wpf

Mouse focus on JLabel
To detect if someone clicked on your label, this code will work: package com.sandbox; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.WindowConstants; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class SwingSandbox { public static void main(String[] args) { JFrame frame = buildFrame(); JPanel panel = new JPanel(); BoxLayout layout = new BoxLayout(panel, BoxLayout.X_AXIS); panel.setLayout(layout); frame.getContentPane().add(panel); JLabel label = new JLabel("Click me and I'll react"); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) {

Categories : Java

No outline on mouse focus but still have outline on keyboard focus?
Browsers use the CSS outline property to show which element has the focus, as you might already know. So, in jQuery, you might use: $(document).ready(function() { $("body").on("mousedown", "*", function(e) { if (($(this).is(":focus") || $(this).is(e.target)) && $(this).css("outline-style") == "none") { $(this).css("outline", "none").on("blur", function() { $(this).off("blur").css("outline", ""); }); } }); }); Explanation: This function looks for the mousedown event on any element. This event is delegated, meaning it will apply to elements currently on the page as well as any created dynamically in the future. When the mouse is clicked over the element, its CSS outline property is set to none; the outline is removed.

Categories : Javascript

C# mouse click event after focus in windows 2012
You should use the Shown event instead: private void Find_Shown(object sender, EventArgs e){ textBox1.Focus(); } Note: you used Paint event which will be very nasty, everytime your form is repainted, your textBox1 will be focused, the Paint event is fired every time your form resizes, state changes, ... we can't determine exactly the time it fires but it fires fairly frequently when your form is running. That is the reason why you can't click on and select anything on your form. That's because clicking or selecting controls fires the Paint event and makes your textBox1 focused then.

Categories : C#

Trouble keeping focus for mouse wheel scroll
Not sure why the odd behavior but I did a sample project and set some event handlers for GotFocus and LostFocus for the web browser controls. I'd output some debug text when an event was fired and it didn't always call the LostFocus event and when this would occur the scrolling would not work. Try setting the focus on Web Broswer Document instead: WebBrowser1.Document.Focus()

Categories : Dotnet

Python win32api mouse control losing focus
Turns out this was not a Python issue, but was an issue with the device I was using to generate mouse movements. A separate API call was required to allow this device to push events when its owner was out of focus.

Categories : Python

C# New window focus
Trying to change the focus while an event is fired is often troublesome, it is here. You'd need a PostSelectionChanged event but that's not available. You can create your own though, Dispatcher.BeginInvoke() can run the target after all the event processing is completed. This solves your problem: private void display_SelectionChanged(object sender, SelectionChangedEventArgs e) { Dispatcher.BeginInvoke(new Action(() => { var editwindow = new EditWindow(); editwindow.Show(); })); }

Categories : C#

How to set focus to a QWidget, on a different window
You will obtain the desired behavious if you change your last loop to something similar: while (1) { // Exits if both windows are closed if (!win1->isVisible() && (!win2->isVisible())) { return 0; } // Eventually changes the focus, if the desired window is still visible if((rand() % 2) == 1) { if (win1->isVisible()) { a.setActiveWindow(win1); } } else { if (win2->isVisible()) { a.setActiveWindow(win2); } } QTime now; now.start(); do { qApp->processEvents(0x00); } while (now.elapsed() < 2000); } Anyway, if you put your program to sleep, it will not respond to user input during that interval, so be careful. The implementation is quite ugly,

Categories : C++

Check if window has focus
Why not use the hasFocus method e.g. if (document.hasFocus()) { ... } If you need to handle iframe's as well then your check just becomes either or e.g. function isFocused() { return document.hasFocus() || document.getElementById('iframe').contentWindow.document.hasFocus(); }

Categories : Javascript

window.focus() only when source changes
It might not be the most efficient way of doing it, but you could rely on the fact that the content changed to know if the file has changed. You could simply store the innerHTML value of the frame's document and compare the newly loaded content against the last loaded content.

Categories : Javascript

Tkinter window focus on Mac OS X
Do wait_visibility and event_generate help ? eg. something like - from Tkinter import * root = Tk() def key(event): print "pressed", event.char def callback(event): print "clicked at", event.x, event.y frame = Frame(root, width=100, height=100) frame.bind("<Key>", key) frame.bind("<Button-1>", callback) frame.pack() frame.focus_set() root.wait_visibility() root.event_generate('<Button-1>', x=0, y=0) root.mainloop()

Categories : Python

python-wnck set focus to window
The solution was actually pretty simpleI just needed to "import time" then pass "int(time.time())" into the activate function Working code: import pygtk pygtk.require('2.0') import gtk import wnck import re import sys import time screen = wnck.screen_get_default() while gtk.events_pending(): gtk.main_iteration() titlePattern = re.compile('.*Geany.*') windows = screen.get_windows() for w in windows: if titlePattern.match(w.get_name()): print w.get_name() w.activate(int(time.time()))

Categories : Python

Adjust MatLab window focus
It sounds like you want to "dock" your window. There is a little curly arrow in the top right hand corner of each window (pointing to the right and down when the window is floating, if I recall correctly). If I understand your question correctly, that would solve it for you..

Categories : Matlab

How to keep focus on more than one window for input devices
This is typically handled via a low level Hook. There is no C# library which will handle this directly, though there is a Microsoft KB article showing How to set a Windows hook in Visual C# .NET.

Categories : C#

Why is this NSMenuItem getting disabled when the window loses focus?
Because menu items are enabled based on the responder chain. In your case, you can use the terminate: selector instead of your own. As this is declared in the NSApplication class, which is also part of the responder chain, the item will then be always active. NSMenuItem *quit = [[NSMenuItem alloc] initWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@""]; More on this here: Cocoa Event Handling Guide

Categories : Objective C

WPF glass window with no border and no resize out of focus
I haven't worked much in dwm apis so I may be wrong but I think the default dwm rendering policy is using WindowStyle to figure out rendering. If you disable that policy, it behaves as you'd expect it to. Add the following bit to fix your blues xD const int DWMWA_NCRENDERING_POLICY = 2; int DWMNCRP_DISABLED = 2; DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, ref DWMNCRP_DISABLED, sizeof(int)); For details of this voodoo, please check the following resources: DwmSetWindowAttribute function DWMWINDOWATTRIBUTE enumeration MainWindow.xaml <Window x:Class="dwm.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"/> MainWindow.

Categories : C#

Vim netrw explore window focus issue
Updated Netrw using the latest version from Dr. Chip's website fixes the problem: http://www.drchip.org/astronaut/vim/index.html#NETRW

Categories : Vim

window.opener.focus() doesn't work
From the fine manual: Makes a request to bring the window to the front. It may fail due to user settings and the window isn't guaranteed to be frontmost before this method returns. Emphasis mine. Calling focus() is just a request and the browser is free to ignore you and you should generally expect to be ignored. Consider what sorts of nefarious things you could get up to by switching focus to a tiny window while someone is typing if you need some reasons why a browser would ignore your request. If you need focus() to work for your application to work then you need to redesign your application so that it doesn't need to call focus().

Categories : Javascript

How to make PyQt App give up window focus?
You can try with setFocusPolicy here is the documentation. http://pyqt.sourceforge.net/Docs/PyQt4/qwidget.html#setFocusPolicy

Categories : Python

Java - Mouse out of window
Check for MouseListener.mouseExited(MouseEvent).

Categories : Java

Modal Window Loses Focus when Tab and Shift+Tab is Pressed
Use this example $("#modalWindow").kendoWindow({ close: onClose, **activate: onActivate** }); function onActivate(e) { var windowElement = this.wrapper, windowContent = this.element; $(document).on("keydown.kendoWindow", function(e) { var focusedElement = $(document.activeElement); if (e.keyCode == kendo.keys.TAB && focusedElement.closest(windowElement).length == 0) { windowContent.focus(); } }); } Check This

Categories : C#

PopUp window is still visible on screen if the MainWindow is out of focus in WPF
You can explicitly close the popup when its owner window is deactivated, i.e. when another window gets the focus and comes to the top, using the Deactivated event: window.Deactivated += (sender, args) => { thePopup.IsOpen = false; }; You might also want to capture the IsOpen state and restore it when the window is Activated.

Categories : Wpf

window focus not working in chrome when switch tabs
Check out this answer, you could easily modify that code to complete the task you've outlined here.

Categories : Javascript

WinApi: Give keyboard focus to new window in new thread
If the window is flashing on the taskbar then your code does not meet the requirements outlined in the SetForegroundWindow() documentation: A process can set the foreground window only if one of the following conditions is true: The process is the foreground process. The process was started by the foreground process. The process received the last input event. There is no foreground process. The foreground process is being debugged. The foreground is not locked (see LockSetForegroundWindow). The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo). No menus are active. An application cannot force a window to the foreground while the user is working with another window. Instead, Windows flashes

Categories : C++

C++ mouse click on certain spot in window
Use SendInput() instead, then you can use flags to move the cursor relative to the window - Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP; How i can simulate a double mouse click on window ( i khow handle) on x, y coordinate, using SendInput? http://www.cplusplus.com/forum/windows/97017/

Categories : C++

Get window handle from taskbar by mouse pos
WindowFromPoint() should do what you need, although it doesn't retrieve handles to disabled or hidden windows. If you need those too you can use ChildWindowFromPoint() to find children of the taskbar window.

Categories : C++

Give focus to a Window launched from a system service using CreateProcessAsUser
Let your application register a (carefully chosen) HotKey via RegisterHotKey and then simulate the key via SendInput In the processing of the WM_HOTKEY message, you should be able to "steal the focus". Remenber: It's BAD to steal focus, but I fully understand the "what my client is asking!" part.

Categories : C++

Get handle to previouly active window where my application may be a tray app or not in focus
Suppose you use ContextMenuStrip for your tray menu: IntPtr lastHandle; public IntPtr GetForegroundWin(){ IntPtr hwnd = GetForegroundWindow(); if(hwnd != contextMenuStrip1.Handle) lastHandle = hwnd; return lastHandle; } //Add a timer Timer t = new Timer(); t.Interval = 1; t.Tick += (s,e) => { GetForegroundWin(); };//Then you can get the foreground Handle by lastHandle t.Start();//this timer will run as long as your application runs. OK, without using timer, we still have another choice using SetWinEventHook. This function can help you hook some callback to catch some events including active window change event. Here is the link for you to learn more: Detect active window changed using C# without polling Here is the code for the solution without using timer (polli

Categories : C#

Chrome: Is it possible to detect losing window focus to the javascript console?
window.onfocus? I really don't understand what do you mean but look at this references. Search for "events": DOM document reference DOM reference Hope it help you!

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.