focus

Approximately how long can you code before becoming distracted?

I noticed it's more and more frequent for me. 5 minutes is probably the longest i can go without checking facebook, or this site, or youtube, etc. What do you do to keep your attention focused on the task, and how long does it last? ...

How do I select the previous control to a container control?

I have a control which contains a NumericUpDown. The updown is only shown when the container has focus, so the container has to be selectable (or else it could never receive focus). I want the control to behave as a single entity with regards to tab order; that is, when the user tabs to the control, it shows the updown and the updown i...

Textbox gets focus but you can't enter anything

I have an ASP.NET gridview that has dataentry textboxes in the footer row. After the user adds a row, I reset focus to the first textbox in the codebehind using something like Textbox1.focus() in the gridview update handler. The problem is that although it looks like the textbox gets focus (the cursor is flashing in the textbox) you can'...

How can I prevent focus change when ShowDialog exits?

I'm trying to implement an alt-tab like behaviour for our application. When the user presses ctrl-tab, a form pops up (using ShowDialog); when they press it again, it focuses the next control in the app's main form. When they release ctrl, the form is hidden. Unfortunately, when that happens, focus is sent to a different control to th...

Javascript popup window doesn't gain focus after first load in Firefox

Hi, Easiest way to explain should be this example http://www.massimofidanza.it/firefox . This works correctly (popup is focussed again) only on IE. Is there any workaround (without closing and opening a new popup)? update: option for javascript to raise popup windows is enabled. ...

asp.net focus lost when scrolling

I have an asp.net webapp with a small bug where anytime you click the page scrollbar the focus gets reset to the first control. I'm seeing this problem in IE 7 and 8, only in my asp.net app, not on any regular webpage (and not in firefox). It seems that its not just a browser lacking-features issue or an existing IE bug (as it behaves ...

Prevent system tray icon from stealing focus when clicked

I am writing an application in Java that places an icon in the system tray (via SWT). When this icon is clicked, I wish to have it automatically type some keys (via the Robot class) into whatever text field is in focus at the time of clicking (could be in any window). Unfortunately, clicking the system tray icon steals the focus away fro...

Set mouse focus and move cursor to end of input using jQuery

This question has been asked in a few different formats but I can't get any of the answers to work in my scenario. I am using jQuery to implement command history when user hits up/down arrows. When up arrow is hit, I replace the input value with previous command and set focus on the input field, but want the cursor always to be position...

JTextField

how to set the focus in the JTextField?? ...

Is there a way to detect if a browser window is not currently active?

I have JavaScript that is doing activity periodically. When the user is not looking at the site (i.e., the window or tab does not have focus), it'd be nice to not run. Is there a way to do this using JavaScript? My reference point: GMail Chat plays a sound if the window you're using isn't active. ...

Modal dialog prevents return of focus after printing

I have a program which prints a series of pages, stopping after each page to ask the user to verify they want it printed and insert the paper to printed to. The problem is, in some situations, it goes and prints the item, which pops up a print progress window, and then when that window goes away it tries to return focus to the form. Bu...

Focus Issues in Wiefen Luo panels

I am having an issues with focus on multiple docking panels. One is a rendering window which use the WSAD keys for camera movement, and the other is a tree control, problem is when I am moving in the 3D world, the selection in the tree control also changes, e.g by having "D" pressed in the 3D window, the items that start with "D" in the ...

Why is only the first shown window focusable

Imagine the code below. Only the first window appears on the top, all of subsequent windows won't nor can they be programatically focused for some reason (they appear in the background). Any idea how to workaround this? BTW, static methods/properties are not allowed nor is any global property. [STAThread] static void Main() { ...

Clicking on Popup outside bounds of TaskPane loses keyboard focus

I'm developing a Microsoft Word TaskPane containing a WPF ElementHost. The hosted WPF uses a Popup that is intended to behave as a ComboBox's does. I believe you can reproduce my problem like this: popup.IsOpen = true; popup.StaysOpen = false; Mouse.Capture(ancestor_of_popup, CaptureMode.SubTree); When a region of the Popup lies out...

How do I focus an existing tab in a window? (web page, not extension)

I'm trying to focus an existing tab when the content reloads. The usual window methods don't seem to work. Here's whats happening: On page_1 I have a link like... <a href="page_2.html" target="page_2">Go to my other page</a> If the tab doesn't exist, when the link is clicked it opens a new tab and takes focus. (Perfect) If you then g...

How to make a button deep in a nested Swing panel get the "keyboard focus"?

I have a swing frame that contains embedded panels that contain other panels, etc. Deep down, there is a button. I want the button to get focus so that pressing the "enter" key would generate an actionPerformed event. However, if I do myButton.requestFocus() or myButton.requestFocusInWindow() the whole window gets the focus, but nothin...

jquery tabindex/focus & hotkeys

There seem to be some problems with tabindex in several browsers so I want to work around these issues using javascript/jquery. Specifically FF3.5 (Mac) doesn't accept tabindex or focus on links at all. I have jquery 1.3.2 and js-hotkeys 0.7.9 running on my website. I have 4 forms on 1 page which I can switch between using a link. Now ...

AS3: TextField Focus

I'm trying to handle a focus event on a TextField so I can select all the text when focusing (tab or click). Seems like I'm doing something wrong here ? txtTextField.addEventListener(FocusEvent.FOCUS_IN, handleFocusIn); function handleFocusIn() { //select all text here } ...

CSS Conflict

Hello all Im trying to do a simple :focus effect for all my INPUT elements, like so: INPUT:focus { border-color: orange; } This works great, until I add this bit of CSS to the style sheet: .form_container .col2 INPUT { border: 2px solid #CCCCCC; margin:0px 0px 0px 0px; font-family:arial; font-size:14px; padding:3px; } Now once I...

*SOLVED NON-PROBLEM* <element>.focus(): how to make it work in both IE6, IE7 and IE8?

EDIT: This turned out to be a local problem in my IE6/7/8 test setup. The problem is a non-issue on a clean default install of IE, no matter what version. You can stop reading now. :) I'm writing a rich web application where I display a popup panel containing a simple text input field. I need to focus this text field immediately, so the...