focus

I have to click the button twice for it to work

橙三吉。 提交于 2019-12-28 05:32:06
问题 So I have a button in my app and an edittext. When I click the button and write something in the edittext, a textview changes. It all works as it should except for one thing. I have to click on the button twice to make it work (only the first time I open activity). The very first time after I open activity I press the button and nothing happens, after that it works as it should. I already did my research on this and as far as I know the thing that is causing trouble is focus, but I tried a

Prevent the keyboard from displaying on activity start

怎甘沉沦 提交于 2019-12-28 04:39:06
问题 I have an activity with an Edit Text input. When the activity is initialized, the Android keyboard is shown. How can the keyboard remain hidden until the user focuses the input? 回答1: I think the following may work getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); I've used it for this sort of thing before. 回答2: Try this also - this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); Otherwise, declare in your manifest file's

How to disable navigation on WinForm with arrows in C#?

只谈情不闲聊 提交于 2019-12-28 04:23:07
问题 I need to disable changing focus with arrows on form. Is there an easy way how to do it? Thank you 回答1: Something along the lines of: private void Form1_Load(object sender, EventArgs e) { foreach (Control control in this.Controls) { control.PreviewKeyDown += new PreviewKeyDownEventHandler(control_PreviewKeyDown); } } void control_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) {

Set Focus After Last Character in Text Box

本秂侑毒 提交于 2019-12-27 13:34:49
问题 I have 3 text boxes for a phone number. As the user types, it automatically moves from one textbox to the next. When the user presses backspace, I can move focus to the previous text box. The problem is that in IE, focus is set to the beginning of the text box. Here's my code, which works fine in chrome. $('#AreaCode').live('keyup', function (event) { if ($(this).val().length == $(this).attr("maxlength")) $('#Prefix').focus(); }); $('#Prefix').live('keyup', function (event) { if (event

How can I change the highlight color of a focused JComboBox

狂风中的少年 提交于 2019-12-27 12:27:26
问题 Let me first explain what I'm looking to achieve. I'm creating a data entry form in Swing, made up of a number of JComboBoxes & JTextFields. A validation routine iterates over those components and determines if the values specified for each control are 'valid' (the details of the validation are irrelevant for the purposes of this example). When the routine identifies that a component contains an invalid value, I want to change the background color of that field, and also the foreground/text

How to set Z-order of a Control using WinForms

假如想象 提交于 2019-12-27 12:05:22
问题 I'm writing a custom TextBox that upon gaining focus changes its border style. As adding a border causes the control to overlap with those neighbouring it, I temporarily bring the text box to the front of the dialog (using textBox.BringToFront() ). However, once editing is complete and focus is lost, I would like to send the control back to its original position in the Z-order. Is this possible (preferably in a simple way!) 回答1: Call the GetChildIndex and SetChildIndex methods of the parent's

PyQt5 GUI freeze caused by Windows focus-follows-mouse

半城伤御伤魂 提交于 2019-12-25 16:47:06
问题 When Windows focus-follows-mouse-without-raising-the-window is enabled by either of the two methods linked to below, I consistently get PyQt5 GUI 'freezes' where you have to type any character in the terminal that you ran python from in order to unfreeze the GUI; complete description and test case (Windows 10, Python 3.6.1, PyQt5) is here: pyqt5 click in terminal causes GUI freeze To enable the focus-follows-mouse-without-raise behavior, try either of these - they both work in Windows 10:

Focus on Label, TextBlock and Border

十年热恋 提交于 2019-12-25 12:47:10
问题 I want to create a flat button with rounded right top and bottom corners. This button needs to have the background changed on clicked and on mouse over. Currently my Markup looks like this: <Border x:Name="MyButton" Height="25" Margin="0,5,0,0" CornerRadius="0 5 5 0" BorderThickness="1" BorderBrush="Gray" Style="{StaticResource myStyle1}"> <StackPanel Orientation="Horizontal" Margin="8,0,0,0"> <Image Source="image.jpg" Height="20"/> <TextBlock Text="My Button"/> <!-- Could also be a label if

window focus not working in chrome when switch tabs

拈花ヽ惹草 提交于 2019-12-25 10:26:32
问题 (function($){ $(window).focus(function(){ document.title = 'focused'; }); $(window).blur(function(){ document.title = 'not focused'; }); })(jQuery); What it's supposed to do: if a tab is focused, the title should be 'focused'; if it's not, then title should be 'not focused'. What it's doing in reality: after leaving a tab unfocused, its title will remain forever 'not focused'. This is working fine in Firefox, but not in Chrome, anyone got suggestions? Thanks! 回答1: Check out this answer, you

NSTextField GotFocus Event Cocoa Swift

狂风中的少年 提交于 2019-12-25 09:48:49
问题 In swift Cocoa is there an event that fires when a NSTextField gets focus for editing. I Come from C# which has GotFocus() and LostFocus() Events. For NSTextfield I could find only these functions which fire after one starts typing. Not as soon as focus is gained. override func controlTextDidBeginEditing(obj: NSNotification) { } func control(control: NSControl, textShouldBeginEditing fieldEditor: NSText) -> Bool { } I Need this because as soon as someone starts editing, I want to show more