focus

How to force the form focus?

自古美人都是妖i 提交于 2019-12-18 19:29:40
问题 How can I force the focus of an form? .Focus() is not working for me. private void button1_Click(object sender, EventArgs e) { var form = new loginForm(); if (Application.OpenForms[form.Name] == null) { form.Show(); } else { form.Focus(); } } What am I doing wrong? 回答1: it should be private void button1_Click(object sender, EventArgs e) { var form = new loginForm(); if (Application.OpenForms[form.Name] == null) { form.Show(); } else { Application.OpenForms[form.Name].Focus(); } } 回答2: You

Keep NSWindow front

て烟熏妆下的殇ゞ 提交于 2019-12-18 19:08:30
问题 I open a NSWindow from my main NSWindow. DropHereWindowController *dropHereWindowController = [[DropHereWindowController alloc] initWithWindowNibName:@"DropHereWindow"]; [dropHereWindowController showWindow:nil]; I want this window to stay on top of my main window when dragging a file from the finder to that "DropHereWindow". However when opening the finder (not having the focus any longer) my "DropHereWindow" goes behind my main window. I tried orderFront, makeKey, makeKeyAndFront but

Black border on IE7 buttons on textarea/input focus

痴心易碎 提交于 2019-12-18 17:34:22
问题 I've run into a weird IE7 problem.. I have some standard CSS styled buttons with a background picture and a solid 1px blue border. They work as supposed except in IE7.. If I click inside a form element (textarea/input-field) it automatically adds a black border on my buttons.. Sometimes it also happends in other cases where elements are in focus/active.. You can see a simple example here The thing is that I need the border on the buttons for styling reasons, so isn't there a way of disabling

Black border on IE7 buttons on textarea/input focus

▼魔方 西西 提交于 2019-12-18 17:34:01
问题 I've run into a weird IE7 problem.. I have some standard CSS styled buttons with a background picture and a solid 1px blue border. They work as supposed except in IE7.. If I click inside a form element (textarea/input-field) it automatically adds a black border on my buttons.. Sometimes it also happends in other cases where elements are in focus/active.. You can see a simple example here The thing is that I need the border on the buttons for styling reasons, so isn't there a way of disabling

switching JTextFields by pressing Enter key

怎甘沉沦 提交于 2019-12-18 13:54:18
问题 I have created number of text fields and I'm wonder how can I switch the focus between the fields by pressing the enter key. In addition, Can I control the Target field ? for example can I defined that by pressing Enter in field A the focus will be change to field C ? 回答1: Simple example: Suppose you have two JTextField s: textField and textField1 textField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { textField1.requestFocusInWindow(); } });

Set focus back to the application window after showing userform

梦想的初衷 提交于 2019-12-18 12:32:57
问题 When showing a userform (running its Show method) it not only shows up on the screen but also takes the focus (the destination of e.g. keystrokes). Say, the userform is a custom made toolbar. Its Show fires in Workbook_Open() but the form itself is used relatively rarely so we want the focus to go back to the main application window right after its appearance. Unfortunately, it seems SetFocus method is not valid for application objects. So how is this done? I suppose the solution for my

Winforms c# - Set focus to first child control of TabPage

别来无恙 提交于 2019-12-18 11:52:47
问题 Say I have a Textbox nested within a TabControl . When the form loads, I would like to focus on that Textbox (by default the focus is set to the TabControl ). Simply calling textbox1.focus() in the Load event of the form does not appear to work. I have been able to focus it by doing the following: private void frmMainLoad(object sender, EventArgs e) { foreach (TabPage tab in this.tabControl1.TabPages) { this.tabControl1.SelectedTab = tab; } } My question is: Is there a more elegant way to do

Winforms c# - Set focus to first child control of TabPage

China☆狼群 提交于 2019-12-18 11:52:01
问题 Say I have a Textbox nested within a TabControl . When the form loads, I would like to focus on that Textbox (by default the focus is set to the TabControl ). Simply calling textbox1.focus() in the Load event of the form does not appear to work. I have been able to focus it by doing the following: private void frmMainLoad(object sender, EventArgs e) { foreach (TabPage tab in this.tabControl1.TabPages) { this.tabControl1.SelectedTab = tab; } } My question is: Is there a more elegant way to do

Keyboard focus vs logical focus in WPF

别等时光非礼了梦想. 提交于 2019-12-18 11:46:07
问题 What is the difference by Keyboard focus and logical focus in WPF? and how WPF focus is different from the focus in winform ? 回答1: see Focus Overview Keyboard focus refers to the element that is currently receiving keyboard input. There can be only one element on the whole desktop that has keyboard focus. In WPF, the element that has keyboard focus will have IsKeyboardFocused set to true. The static property FocusedElement on the Keyboard class gets the element that currently has keyboard

Visual Studio: How to stop breakpoint hit from stealing focus?

大憨熊 提交于 2019-12-18 10:12:20
问题 When a breakpoint is hit in Visual Studio, it steals the focus from whatever other application the programmer is viewing/typing into at that moment. This can be very irritating since VS grabs any keyboard input the programmer was typing into the other application at that moment and takes that input as its own. What are the tricks you folks use to prevent this focus steal? (I face this on Visual C++ 2008 and 2010. I am guessing it is a problem for Visual Studio in general and for all recent