focus

Get focused MenuItem in submenu WPF

╄→гoц情女王★ 提交于 2019-12-20 03:06:58
问题 I'm writing an application with menu containing submenus. Also I have a StatusBar where I want to display information about focused MenuItem when user navigates in menu with keyboard. I tried to handle GotFocus event from each MenuItem and change StatusBar's content to sender's Tag, but it works only with MenuItem 1, not with 1.1 and 2.2. XAML: <Menu Height="23" x:Name="mainMenu"> <MenuItem Header="Header1" Tag="Info1" GotFocus="MenuItem_GotFocus_1"> <MenuItem Header="Header1.1" Tag="Info1.1"

How to be notified that a composite's child received/lost focus?

跟風遠走 提交于 2019-12-20 02:34:10
问题 I have an SWT Composite that I need to pass to some other code which will add children to it at will. Is there any way to be notified that a child of the composite received and lost focus? Just to make sure it's clear, I cannot add listeners to each child, because I'm not in charge of creating those controls. A child could be added at any time. 回答1: As noted by Favonius, you can hook layout events like SWT.Resize to determine when you're being painted and recompute your child hierarchy,

jquery set focus on dynamic content?

邮差的信 提交于 2019-12-19 16:57:37
问题 In jquery I've appended a <li> element to an unordered list. How do I focus on the newly created <li> ? If I do the following: $("ul").append('<li><input type="text" value="Hi!"></li>'); $("li:last").focus(); //doesn't work because new <li> isn't in dom yet the focus doesn't work, as noted above. I know jquery 1.4.2 has a live() event handler which allows you load event handlers to dynamically added elements, but I'm not sure what I'm doing wrong: $(document).ready(function () { $('li').live(

jquery set focus on dynamic content?

旧街凉风 提交于 2019-12-19 16:56:40
问题 In jquery I've appended a <li> element to an unordered list. How do I focus on the newly created <li> ? If I do the following: $("ul").append('<li><input type="text" value="Hi!"></li>'); $("li:last").focus(); //doesn't work because new <li> isn't in dom yet the focus doesn't work, as noted above. I know jquery 1.4.2 has a live() event handler which allows you load event handlers to dynamically added elements, but I'm not sure what I'm doing wrong: $(document).ready(function () { $('li').live(

How to set focus the already running application?

我的未来我决定 提交于 2019-12-19 11:06:16
问题 I am using a ServerSocket port to run one instance only of my Java Swing application, so if a user tries to open another instance of the program, i show him a warning that "Another instance is already open". This works fine, but instead of showing this message i want to set focus on the running application itself, like some programs does (MSN Messenger), even if it was minimized. Is there a solution for this for various operating systems ? 回答1: Since you use a server socket I assume that you

Start editing in a cell in JTable on gaining focus

徘徊边缘 提交于 2019-12-19 10:57:07
问题 I have defined cell editors for the two columns in my table in the following manner: Java Code: JComboBox combo = new JComboBox(); //code to add items to the combo box goes here. JTextField textField = new JTextField(); textField.setHorizontalAlignment(JTextField.RIGHT); TableColumn column = myJTable.getColumnModel().getColumn(0); column.setCellEditor(new DefaultCellEditor(combo)); column = myJTable.getColumnModel().getColumn(1); column.setCellEditor(new DefaultCellEditor(textField)); The

Is there anyway to give Flash focus in a browser without required the user to click it?

一笑奈何 提交于 2019-12-19 09:45:00
问题 I have a flash (flex) web application and when it first loads the cursos is in the username field blinking. However, you can't start typing because Flash does not have focus. You have to first click on the flash app. Is there anyway to give Flash focus on load? Would this be in the html or in flash? Thanks. 回答1: You should use Javascript. Here's an official how-to: http://kb2.adobe.com/cps/155/tn_15586.html 回答2: The method linked by Zilupe described in the note is for Windows IE only,

Could Label get a focus?

强颜欢笑 提交于 2019-12-19 08:00:46
问题 I have a one question on my university's test about C#. Could label get a focus? As I can see on MSDN site, all Controls can get a focus, but some of them aren't selectable. So it's seems to me that the right answer is "Label could get a focus, but couldn't be selected". Also Label has a Focus() method. Please, help me understand. Thanx. 回答1: Yes there is a Focus() method on Label and yes it is absolutely right it works; but behave differently. let me try to explain A Label can be associated

Java - Show a minimized JFrame window

流过昼夜 提交于 2019-12-19 07:24:35
问题 If a JFrame window is minimized, is there any way to bring it back to focus? I am trying to get it to click a certain point, then restore it. while (isRunning) { start = System.currentTimeMillis(); frame.setState(Frame.ICONIFIED); robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); frame.setState(Frame.NORMAL); Thread.sleep(clickMs - (System.currentTimeMillis() - start)); } 回答1: If you want to bring it back from being iconified , you can just set its state to normal :

Java - Show a minimized JFrame window

試著忘記壹切 提交于 2019-12-19 07:24:20
问题 If a JFrame window is minimized, is there any way to bring it back to focus? I am trying to get it to click a certain point, then restore it. while (isRunning) { start = System.currentTimeMillis(); frame.setState(Frame.ICONIFIED); robot.mouseMove(clickX, clickY); robot.mousePress(InputEvent.BUTTON1_MASK); frame.setState(Frame.NORMAL); Thread.sleep(clickMs - (System.currentTimeMillis() - start)); } 回答1: If you want to bring it back from being iconified , you can just set its state to normal :