focus

How do I find out which control has focus in .Net Winforms?

How do I find out which control has focus in winforms? ...

Javascript focus measurement

I'm looking for a Javascript library to be able to measure the time a div (or any other object) has been in "focus" (as in: the browser is showing and the window is focused; not the normal Javascript focus event). Do you know if something like that exists ? or something similar I can tweak? Edit: Ok. Rephrased to avoid misunderstandin...

WPF - Can't set focus to a child of UserControl

I have a UserControl which contains a TextBox. When my main window loads I want to set the focus to this textbox so I added Focusable="True" GotFocus="UC_GotFocus" to the UserControls definition and FocusManager.FocusedElement="{Binding ElementName=login}" to my main windows definition. In the UC_GotFocus method i simply call .Focus() ...

Opening a form in C# without focus

I am creating some always-on-top toasts as forms and when I open them I'd like them not to take away focus from other forms as they open. How can I do this? Thanks ...

Moving keyboard focus away from listbox

Hi! I'm developing a program in WPF (VB) that relies on keyboard navigation only. In my program, I have a listbox that displays up to 20000 items. What I want is that when the listbox has keyboard focus, and I move to the bottom item that is visible (using ArrowDown), I want the focus to move to the next item outside the listbox. I'm...

Delphi: Show window without activation

I struggle to show a second form above the main form without losing focus. I have tried ShowWindow(second.handle, SW_SHOWNOACTIVATE), but the mainform loses focus. If I set Visible := false on the second window, the call to ShowWindow does not activate the second form, but the windows is empty when shown... Does anyone have a good reci...

focus in Safari 4 beta selects content

I want to use the defaultfocus property on a form in ASP.Net, and therefore I set this property to a textbox. This works as expected on IE, but in the Safari 4 beta, the content of the textbox is also selected. How can I make this work as expected on Safari? i tried also some jquery call, and the problem is there also: $("input:visib...

Google Chrome breaks when onfocus sets select size

The following javascript to resize a select list breaks in Google Chrome. It works when tabbing into the field, but clicking on it results in the "Aw, Snap!" error page. <select onfocus="this.setAttribute('size', 3);"> <option>selectList with onfocus</option> <option>2</option> <option>3</option> <option>4</option> </select> Works fin...

how to make a DIV unfocusable?

I met a problem about HTML rendering. In dir="rtl" document of IE7, when JavaScript tries to set focus to a DIV element(with oElement.focus() method), the rendering turns to mess. The context is very complicated, so I suppose the easiest fix is to make the DIV unfocusable? Is there any way to make a DIV not be focused? ...

winform mdi catch child form focus c#

I would like to be able to catch a child window focus event, in an mdi form. If i loose focus to the entire mdi application, then click on a child, it works, but if I had two child forms open, I cannot catch the focus event when clicking between them. I am using Dotnet Framework 2.0, and I need the code solution that will run fine on a...

In Swing, how can I find out what object currently has focus?

I have few TextFields on my frame. I want to know the TextField name which is currently focused. Can someone please help me? How can I find out the current focused object name? Thanks ...

Javascript focus() and select() quirk

Im working on a form and getting null or not an object errors in ie. <form action="#" method="post" name="adv_search"> <input class="inputbox" type="text" name="keyword1" value="none" id="keyword1"/> </form> <script> document.adv_search.keyword1.focus(); document.adv_search.keyword1.select(); </script> //whereas if I use <script> v...

Delphi CMExit message not sent when modal dialog is closed?

In one part of the application I'm working on, there is a form control that does validation on reception of the CMExit message, which is exactly how the Delphi documentation says to do it (this code sample is from the Delphi Help files): procedure TDBCalendar.CMExit(var Message: TWMNoParams); begin try FDataLink.UpdateRecord; ...

What's the difference of Click-to-focus and focus-by-javascript?

I met one troublesome web page whose structure is complicated. If one DIV is clicked by mouse, everything is OK. However, if it is focus-ed by javascript(i.e. divElement.focus). The layout turns to messy. This only happens in IE7/8. So, is there any difference between click-to-focus and focus-by-javascript in IE? ...

Why DIV shifts when focus() is invoked in onBeforeDeactivate event handler?

I met a wired problem for a web page in IE7/8. The page configured to be dir="rtl". And divRow is made very large width so as its containing div doesn't wrap. Click the editor area, type some words, then click the "Hello world" text. The layout will turns to be messy, because the offset and width of div with divRow class changed. I su...

ASP.NET: Scroll to control

I've got a particularly large form in an page. When the form is validated and a field is invalid, I want to scroll the window to that control. Calling the control's Focus() doesn't seem to do this. I've found a JavaScript workaround to scroll the window to the control, but is there anything built into ASP.NET? ...

How do you find the best way to focus on a coding project/task?

In short, when you have planned or have thought about an idea to create - what do you use to help keep you on task, or to make sure you stay programming without (negative) distraction? I've found that reading books and being around like minded people does help with motivation, although when it comes time to being by yourself typing away...

Iframes, pdfs and focus with internet explorer

So - I have a page which contains a textarea and a dynamically created IFrame which displays a PDF using the adobe acrobat plugin. Initially the textarea is focused. I want the textarea to be focused, but the IFrame steals focus when the pdf is loaded. In firefox it is trivial to reset the textarea as the focused element. I do this...

Why is is a TabHost stealing focus from a TextView in Android ?

I have an application using the following layout : When the app start, the focus is on the first TextView, but if you try to type any letter in it, the focus goes directly to the tabs. It seems that I am not the only one fighting with this issue, and maybe this is related to the following : http://groups.google.com/group/android-deve...

Flash & Flex SDK/AS3 - How to keep keyboard focus?

I'm writing a flash application in Flex/AS3, and I can't seem to assign keyboard focus to it. I was mindful of this problem early on in development and added a splash screen with a "play now" button, to entice the user to click. However, the user must then click a second time on the application for the keyboard to work! To make matters ...