setfocus

textBox embedded in a ListBox initial focus

牧云@^-^@ 提交于 2019-12-11 02:06:51
问题 I want to set the focus to the first ListBox item that is a textbox. I want to be able to write in it immedatelly without the necesity to click it or press any key. I try this but doesn't work: private void Window_Loaded(object sender, RoutedEventArgs e) { listBox1.Items.Add(new TextBox() { }); (listBox1.Items[0] as TextBox).Focus(); } 回答1: it's stupid but it works only if you wait a moment, try this version: using System; using System.Windows; using System.Windows.Controls; namespace

SDL2 Raising a window without giving it focus

强颜欢笑 提交于 2019-12-10 20:28:39
问题 I need to display a tooltip over a window. I'm creating a second window with the tool tip and using SDL_RaiseWindow() to bring it to the top. However, doing that causes the tooltip to steal focus which is not what I want. Is there a way to bring a window to the top without changing focus? Also, is there a way to set focus (mouse and/or keyboard) without changing the Z order of the windows? 回答1: The answer offered by Neil will only work under X11 as SDL_SetWindowInputFocus() is only

Set input field focus on start typing

爱⌒轻易说出口 提交于 2019-12-10 09:35:50
问题 I am looking for a way to be able to start typing on a website without having selected anything and then have a specific input field in focus. Google also employs this feature. In their search results you can click anywhere (defocus the search field) and when you start typing it automatically focuses on the search field again. I was thinking about jQuery general onkeyup function to focus on the field, any suggestions? Much appreciated. 回答1: You should bind the keydown event, but unbind it

Can't Set Focus in Safari

蹲街弑〆低调 提交于 2019-12-08 09:12:31
问题 I'm trying to set focus to a particular edit field when a page opens or button is pressed. The following simple HTML/Javascript (Test.html) works with Firefox and Chrome but not Safari. Safari will clear the text with the clear button and post it with find button but not select it when the select button is pressed. Any help would be appreciated. (iOS 7 on an iPad 2) Update -- Replaced with working code <html> <head> <!-- Latest JQuery; Must be loaded before Bootstrap --> <script src="https:/

JavaFX custom MasterDetail pane

徘徊边缘 提交于 2019-12-06 13:37:29
问题 I have created a custom Master-Detail pane for my project, where i use a split pane, in each i have two Anchor Panes. In one there is a TableView filled with Users (ObservableList). On each row (User) i have implemented a ChangeListener table.getSelectionModel().selectedItemProperty().addListener(listElementChangeListener()); when the row is selected, i pass the UserObject for my DetailPane, and visualize User data in TextFields as detail. I have implemented controls, to understand if the

Send focus to dynamic li with jQuery

醉酒当歌 提交于 2019-12-06 10:37:45
I was wondering if you can send focus to a dynamic li. Here's what I'm trying to do: I've got a search box that has a keyup function bound to it where it searches for people's names. The results appear in a div right below the search box with a ul of results. I was hoping to make it where if someone hits the down arrow button that the focus gets switched to the first element of the ul. Kind of like how a drop down works. Here's the code (I didn't put in all the CSS so it doesn't look as pretty as it should--just FYI) $(document).ready(function(){ $('#search_name').keyup(function(e) { if(e

EditText loses focus on Scroll in RecyclerView

白昼怎懂夜的黑 提交于 2019-12-05 14:19:35
I have a RecyclerView which have EditText as its list items. When i scroll the RecyclerView , the EditText loses focus when the item goes off screen. So the focus does not remain on the EditText when it comes back on the screen on scroll. I want the focus to remain on the same item. For that i also tried storing position of the item on focus and reassigning the focus in onBindViewHolder . But that slow downs the scrolling. I also tried this with ListView but there is another kind of focus related problem. Focus jumps there. Have searched for this lot on SO and Googled a lot. but always found

Set input field focus on start typing

三世轮回 提交于 2019-12-05 13:56:20
I am looking for a way to be able to start typing on a website without having selected anything and then have a specific input field in focus. Google also employs this feature. In their search results you can click anywhere (defocus the search field) and when you start typing it automatically focuses on the search field again. I was thinking about jQuery general onkeyup function to focus on the field, any suggestions? Much appreciated. You should bind the keydown event, but unbind it immediately so that typing may continue in other text inputs without reverting focus to the default input. $

requestFocus() returning false

一曲冷凌霜 提交于 2019-12-05 11:55:08
I am inflating a view when a button is pressed. The inflated view is like a dialog box, however when I try to get focus on the dialog box with requestFocus() , requestFocus() returns false means I am not getting focus on the view, but when I manually tap the inflated view, it recieves focus. What am I doing wrong? I clear focus from the button (which is used to inflated the new view) before I call requestFocus on inflated view. Regards A possible reason why the View.requestFocus() method returns false (does not successfully request focus) is because of the following reason: "A view will not

Setting focus on a button is not working

我是研究僧i 提交于 2019-12-05 00:04:20
I am trying to set the focus to a button while the user presses the Enter key in the text box. But it is not working. I am using the Internet Explorer 8 browser. Am I missing something? $("input.Box").live('keydown', function(e) { if (e.keyCode == 13) { e.preventDefault(); $("#button").focus(); // Not working? } }); Microsoft decided that they don't like e.keyCode and instead have their own syntax, e.which . You have to check for both: $("input.Box").live('keydown', function(e) { var keyCode = (window.event) ? e.which : e.keyCode; if (keyCode == 13) e.preventDefault(); $("#button").focus(); //