How can I give focus to WinJS.UI.settingsFlyout after animation? - windows-8

I'm invoking a WinJS.UI.settingsFlyout element via Javascript using WinJS. Inside the HTML element of the settingsFlyout, I have a text input field that I would like to receive focus after the animation of the flyout occurs. I've tried to use jQuery's .focus() method, but it does not work because I do not think the flyout is focused after it completes its animation. I have to click twice on the input field to begin typing. I click once to get the flyout in focus, and then click another time to get the field in focus. Quite annoying. Is there a way to implement auto focusing of input fields within a WinJS.UI.settingsFlyout?

Have you tried?
settingsFlyout.addEventListener("aftershow", function(){
$('#inputId').focus();
});

Related

robotframework- unable to click a button on a modal dialogue box

when I open a particular webpage it has a EULA form that appears on top of the home page in the form of a modal in HTML/CSS. I have tried the XPath of the accept button but it says element not found also tried using handle alert.
is there a unique way to handle a dialogue box in robotframework?
image of HTML in inspect view
SeleniumLibrary.Set Focus To Element ${button_on_popup_page}
SeleniumLibrary.Click Element ${button_on_popup_page}
I figured it out, shown in the above code. I first set focus to the button and then used the click element. This seemed to work.

tabindex not being set when textbox has focus

I have a textbox that when focused it calls an ajax request and populates a list for the user to choose from. Basically just recreated the dropdown using a textbox instead of a select.
The problem is that if I click on the textbox the browser does not recognize the tabindex of the input. Instead it resets its self and starts back at 0. If I tab to the next element tabs work fine, only when I click in the input field to give it focus does it start acting up.
I did notice last night if I put an alert in the page on the focus event that it seems to work. Guessing because the browser focuses on the elememt after I click the ok button.
has anyone heard of this before?
found what was causing the problem. I was calling .blur() on keydown and code was 9 or 13 (Tab/Enter). Not sure why this would give me the problem I was having. I would have just thought the blur event would have executed twice. However I suppose that I was forcing blur on keydown and the current tabindex was not being set. If this is the case then If I needed to I should beable to call blur() onkeyup event.

Activate dojo dgrid editor using keyboard

Triggering edit mode in dojo dgrid with mouse event is easy. Here's what I have done:
editor({field: "checkNumber",label: "Check Number",editOn: "click"})
However, i want to trigger edit mode using keyboard. Specifically, i want to go into edit mode when I press the space key. How can I programmatically set a cell to 'edit mode' or 'non-edit mode'?
When you add one or more editor columns to a grid, it makes the edit method available on the grid instance, which you can call with a cell element (or event referencing one) to programmatically shift focus to the editor for the cell.
Meanwhile, the Keyboard mixin has an addKeyHandler method which you can use to add handlers to respond to keydown events for particular keys.
Combining these two things, you can easily do the following to cause the grid to edit the focused cell when space is pressed:
grid.addKeyHandler(32, function (event) {
grid.edit(event);
});
(edit should have no effect for cells in non-editor columns.)
An alternative solution could be to create an extension event which triggers either on mouse click or on space keypress, and pass that to editOn instead of 'click'.
var grdobj = dijit.byId("...");
var editCell=grdobj.cell(rowNo, "checkNumber");
grdobj.edit(editCell);
Instead of cell function, you could make use of right, left, up, or down functions.
Hope that helps.

Need to change focus to another text box before buttons are activated

I am entering data into text fields in a browser via "type" command. In order for the Save and Cancel buttons to be activated (not grayed out), I need to click in another text field to change focus. This works manually, but I can't seem to figure out how to do it programmatically. I have tried click, clickAt, doubleClick, mouseOver/click/mouseOUt, mouseDown/mouseUp, focus, fireEvent ... all without luck. Thanks for any suggestions!
Does tabbing out of the input field enable the buttons? If so, maybe you can just do:
WebElement element = driver.findElement(By.id("your_input_field"));
element.sendKeys(Keys.TAB);

Modal Window Problem

I am using modal window for my VB.NET program and i am trying to open this child modal window from another window, afte i close the child modal window i am trying to refresh the parent but i am getting retry/cancel popup, i tried a lot of things to avoid but i can't get rid of this popup :-( is there any way i can avoid this popup? I would really appreciate your help
Thanks
Faisal
Did you tried to bind an OnClickClient javascript function to the button who close the modal popup to manually call a PostBack to the server ?
function fnClickOK(sender, e) {
__doPostBack(sender,e);
}
that's the function you must include in your code and you can bind the button in the code behind like that
yourButton.OnClientClick = String.Format("fnClickOK('{0}','{1}')", yourButton.UniqueID, "");
Like that, the postback should occur and because of the page reload all Modal will be hided.
Good Luck!