focus

How do I make a field autofocus?

你离开我真会死。 提交于 2020-01-30 05:11:06
问题 I need this field to be focused when the user opens the page. I don't know if it changes anything but it's inside a modal window I load from a PHP file. Is there an easy way to do it? 回答1: JavaScript autofocusers (as given in the other answers here) will work but can be annoying for some users. For example, if you focus a different field while a page is still loading, the JavaScript may "help" you by moving the focus and making you type in the wrong field. This question on ux.stackexchange

c# TextBox border changes when it gets disabled compared to other disabled TextBox(es)

∥☆過路亽.° 提交于 2020-01-29 17:54:17
问题 I have a really strange problem. I have multiple TextBoxes for username/passwords, and a CheckBox beside every user/pass group. When user clicks on the CheckBox, and if he checked it, the username and password TextBox beside it become enabled and focus is set to username TextBox. If user unchecked the CheckBox the TextBoxes beside it become disabled. However the border of one TextBox stays different than other disabled TextBoxes. See: I've thought it was a focus problem, so I've changed the

How do I prevent the original form from losing focus when I show another form?

≡放荡痞女 提交于 2020-01-25 01:50:07
问题 I am having a problem where my main form loses focus when opening a new form. I know I can revert the focus back by using mainForm.focus() , but how do I handle things if I want the main form to never give up its focus when new window is opened? 回答1: You can accomplish this by overriding the property ShowWithoutActivation in order for it to return true in the forms that you want to show without stealing focus from the form that shown it, in your case that would be your main form. 回答2: Cody

Firefox 3 window focus and blur

社会主义新天地 提交于 2020-01-24 12:03:09
问题 $(window).blur(function(){ windowFocus = false; }).focus(function(){ windowFocus = true; }); The problem is that in firefox 3, when I create a new tab, it does not lose windowFocus. Where as in ff2, ie7 it does lose. In ff3 it only loses window focus when i select another program. Anyone have a solution to this problem? 回答1: Attach to the events on document instead: $(document).blur(function(){ windowFocus = false; }).focus(function(){ windowFocus = true; }); ...FWIW, this appears to have

jQuery form focus following element creation

女生的网名这么多〃 提交于 2020-01-24 04:37:26
问题 Looking for some assistance with my jQuery code. I am creating a modal box, using the simplemodal plugin I am managing to create a modal box on the click of an element, which contains a form....I would like the form to have focus on the textarea field when it appears, but am unsure of how to achieve this.. Here is my current code.. $('#showModal a').live('click',(function(){ // Build Modal Box Container And Add to Page $('<div id="osx-modal-content">\ <div id="osx-modal-title"><h2>Please

C#/.NET: TextBox is not 'focused' after a process was initiated

倖福魔咒の 提交于 2020-01-24 00:44:30
问题 I am having a problem after opening the notepad once I click the button "btnSearch". The idea is that once I clicked the button 'btnSearch', the textbox 'txtSearch' should be 'focused' even after a process was initiated/opened outside the main window. Here's my code: private void btnSearch_Click(object sender, RoutedEventArgs e) { System.Diagnostics.Process.Start("notepad"); txtSearch.Focus(); // not working } Any suggestions? 回答1: The below is the code you would need. This could be done

Android, how to get information on which activity is currently showing (in foregorund)?

杀马特。学长 韩版系。学妹 提交于 2020-01-23 17:40:08
问题 I wonder if there is a way to get information on which activity currently has focus (is in the foreground)? I am using instrumentation and I would like to know which activity is currently running in the application that I am testing against. Thanks 回答1: Take a look at Robotium 'a open-source test framework created to make automatic black-box testing of Android applications significantly faster and easier than what is possible with Android instrumentation tests out-of-the-box.' Homepage: http:

WPF: Setting Keyboard Focus in a User Control? (Problems with KeyBinding)

烈酒焚心 提交于 2020-01-22 14:20:07
问题 I have an app that has a main window that contains a bunch of stuff. From time to time the user will do something in response to which I want to display something else entirely in the main window, temporarily hiding what is there. I'm doing this by making the outermost element in the main window a Grid with no rows or columns defined. Every element in the grid, then will completely fill the one single cell in the grid, drawing on top of the others. My regular bunch stuff, then, is in the

How to reset / remove chrome's input highlighting / focus border? [duplicate]

半城伤御伤魂 提交于 2020-01-18 04:47:32
问题 This question already has answers here : How to remove focus border (outline) around text/input boxes? (Chrome) [duplicate] (11 answers) Closed 4 years ago . I have seen that chrome puts a thicker border on :focus but it kind of looks off in my case where I've used border-radius also. Is there anyway to remove that? 回答1: You should be able to remove it using outline: none; but keep in mind this is potentially bad for usability: It will be hard to tell whether an element is focused, which can

Panel not getting focus

流过昼夜 提交于 2020-01-18 02:22:11
问题 I am continuing to program some kind of keyboard navigation in my simple graphic program (using C#). And I ran into trouble once again. My problem is that I want to process the keyboard input to move a layer around. Moving the layer with the mouse already works quite well, yet the control doesn't get the focus ( neither KeyUp/KeyDown/KeyPress nor GotFocus/LostFocus is triggered for this control ). Since my class derives from Panel (and overwrites a couple of events), I've also overwritten the