focus

How to put focus on an element in jQuery?

Hi, I have done the following code in JavaScript to put focus on the particular element (branch1 is a element), document.location.href="#branch1"; But as I am also using jQuery in my web app, so I want to do the above code in jQuery. I have tried but don't know why its not working, $("#branch1").focus(); The above jquery (focus()...

How to determine which control on form has focus?

Hi, I've read elsewhere on here that to capture "Enter" key stroke in a text box and use it as if pushing a button I should set the KeyPreview property of the form to true and check the value of KeyDown. I want to be able to use this functionality on several TextBox controls which each are associated with a different Button. My quest...

WPF Maintain Keyboard Focus

I'm creating a UserControl consisting of a TextBox and a ListView. I want keyboard focus to remain with the TextBox as long as the control has keyboard focus (selection changes in the ListView shouldn't remove keyboard focus from the TextBox). I've tried catching GotKeyboardFocus in the ListView and passing keyboard focus back to the Te...

How to select an element that has focus on it with jQuery

How can you select an element that has current focus? There is no :focus filter in jQuery, that is why we can use something like this: $('input:focus').someFunction(); ...

Setting focus to an swf using JS

How do I set the focus on a SWF embedded in a page using Javascript? I tried to use the usual method but it doesnt seem to work... ...

focus issue using a JComboBox as a cell editor in a JTable

I'm having issues with the following code, where I use a JComboBox to change a String value in a table cell. The JComboBox works fine, but if I click in the box and then click away without selecting anything the JComboBox's dropdown remains visible, even if I delete the row. Clicking on another Swing component like a JButton often caus...

C#: Activate a TextBox when user starts typing

I want to activate a search textbox when the user starts to type something (even if the textbox isnt focused right then). I have come as far as setting KeyPreview on the form to true. Then in the KeyDown event handler, I have this: if(!searchTextBox.Focused) { searchTextBox.Focus(); } This almost works. The textbox is focused, but...

TreeView re-grabs focus on Ctrl+Click

I have a WinForms TreeView control that I would like to use to open another form based on which node is currently selected. I want to open that other form when I Ctrl+Click on the node. Currently, it works the way I would like if I open the other form in a DoubleClick handler (and double-click on the node, obviously); however, if I use...

Form's lost focus in C#

This may be a simple C# question but I need a solution thou' I have two forms, form1 and form2, with form1 having a button. On the click of the button, I wanna show form2. But when this form2 looses foucs I wanna hide it (form2). How do I do it ?? I tried to subscribe to LostFocus event of form2, but it isn't working. Please help me w...

Focus DataTemplate in WPF

The behaviour I am looking for is that a selection of a Item in a ListView results in focusing the first focusable visualchild. Problem: datatemplated data in a ItemsControler which does not get an initial focus. In the example below there are 4 Strings which are then stuffed into a TextBox via Datatemplate. Example: <Window xmlns="ht...

Focus control in a ListView

The context: I want to have a ListView that wouldn't receive focus (e.g. won't highlight row when user touches it). Yet each row widget has it's own OnClickListener. Here's what I specify in layout xml: android:choiceMode="none" android:focusableInTouchMode="false" android:focusable="false" The ListView still behaves exactly the same....

How do I detect control entering/leaving on a per-application basis, without access to the control's form?

I can use the Control.Enter and Control.Leave events to detect when user focus enters or leaves a control, but this only works on a per-form basis. I use more than one form in my application, and want to track which control has user focus, I have to use the forms' Activated and Deactivated events to track which form is active and then t...

topmost window form steal focus

Hi everyone, I develop a window form application that shows message like msn alert at the right corner of desktop. I set form's topmost property to true but it steals other application's focus while I work on them. I don't want application steal the focus that is annoying. How can I solve this problem . Any suggestion? Best regards. ...

WPF: Remove dotted border around focused item in styled listbox

I have a horizontal listbox with a custom controlIemplate. The selected item gets a dotted frame when focused. Anyone know how to get rid of it? ...

Why does a WPF Popup close when its background area is clicked?

I have a WPF Popup control that contains some editing controls (list boxes, text boxes, check boxes) laid out with quite a bit of whitespace. Popup.StaysOpen is set to False, which is required. If the user clicks elsewhere in the application, the editing operation should be considered aborted and the popup should close. Unfortunately ...

How do I bring my window to the front after a DDE event?

On a DDE event my program loads a file in and should pop to the foreground. I was using show; It only seems to be working like then when i have hidden the window. So i added bringtofront; Again this worked if it was hidden, closed, minimized or in the icon tray but not if it was open just under another window. I even tried some ...

Stop browser forcing form element into window view.

Any ideas how to stop browsers from forcing focused form fields into view when positioned overflow hidden? ...

Setfocus to textbox from JavaScript after just creating the textbox with JavaScript?

So I just created a textbox with JavaScript like this: EDIT: Added the len variable var len = tbl.rows.length; var rtb = tbl.insertRow(len); var cName = rtb.insertCell(0); var cDis = rtb.insertCell(1); var cDur = rtb.insertCell(2); ...

Gaining focus in a win forms app?

I feel like I'm commiting a cardinal sin by asking how to do this becuase in most instances it would be wrong and evil. But... I have a winforms app that minimises to the systray when not being used I want to make it pop up and be the topmost window when it recieves a message from a server. I can make it appear, but I can't get it to b...

How to determine if a textbox in a windows form has focus

Hello, Let's say I have internet explorer embedded in a windows form and I then navigate to a random page on the web. How can I determine when a textbox (or any other control that can accept text input for that matter) becomes the item in focus? Basically, every time the mouse is clicked I can check to see if the item in focus is a te...