Multiple "More" buttons on iPad simulator. How do I narrow it down which one to click (either one)? - objective-c

I am trying to tap the More button in a XCUITest:
XCUIElement* moreKey = self.app.keys[#"more"];
[moreKey tap];
and on iPhone simulator it works fine, but on iPad simulator it crashes when I try to tap it:
Failed to Error Domain=com.apple.dt.xctest.ui-testing.error Code=10006
"Multiple matching elements found for <XCUIElementQuery: 0x600000c51c20>
...
The issue is that it finds multiple instances of the "More" button on iPad (which, unlike iPhone, it has two of):
...}
↪︎Find: Elements matching predicate '"more" IN identifiers'
Output: {
Key, 0x15e670f80, {{0.0, 1049.0}, {132.0, 60.0}}, identifier: 'more', label: 'numbers'
Key, 0x15e678570, {{546.0, 1049.0}, {98.5, 60.0}}, identifier: 'more', label: 'numbers'
So, it doesn't seem to know which one to click.
I found similar questions, but for custom buttons, where solution was to make their identifier unique. That's not applicable for Apple's own "More" key, the identifier of which I do not control.
How do I fix it?
Can I apply elementBoundByIndex: here somehow?

XCUIElement* moreKey = [self.app.keys[#"more"] firstMatch] does the trick.
I will leave the question open in case anyone has a better (or just different - I will accept different) solution.

Related

Keyboard shortcuts on Flutter web

I'm adding keyboard shortcuts to a Flutter web application.
I have a form within a custom FocusableActionDetector where the shortcut has form like this:
SingleActivator(LogicalKeyboardKey.digit2)
and action is like:
CustomActivateIntent: CallbackAction<CustomActivateIntent>(
onInvoke: (intent) { provider.value = "2"; },)
In the same form I have a couple of numeric TextFormFields. To permit writing the character "2" I have to put these text fields inside some new FocusableActionDetector, otherwise the previous detector catches the command and the text field loses the "2" character, and this is already quite weird... Moreover, after writing in any of the text fields the form focus detector doesn't work anymore.
I think this could be related to the focus system, which is yet not that clear to me.
Can anyone help find a clean solution?
I found a workaround: the FocusableActionDetector is now preceded by an if statement. The code looks like the following:
// I extract the form to a widget to make it clearer
var searchWidget = SearchWidget();
child: textEditingInProgress
? searchWidget
: FocusableActionDetector(
child: searchWidget,
...,
),
The textEditingInProgress bool is a field in a provider and is controlled by the FocusNodes belonging to the TextControllers.
Still this is not a perfect solution, in particular I'd like to understand why the previous approach was not working.

Remove button faces

Hi all.
I want to know that how can I remove two button face with a button.
I tried this:
gui: [
en: button "English" remove [en es]
es: button "Spanih" remove [en es]
]
And than I have to append new buttons.
View engine models GUI interface as a tree of objects; each node in that tree is called a face, and each field of that face is called a facet.
Two facets, parent and pane, interlink a face with its parent node and its child nodes, respectively. So, by that theory, to remove a button is to remove a button face from a pane of its parent:
view [button "Poof!" [probe select take face/parent/pane 'text]]
This, however, is a bit limited approach. The removed face is detached from View tree and can no longer be used unless you reattach the face! object with the same specification back to the pane. It might be more useful to simply disable a button, or to render it invisible for the time being. enabled? and visible? facets can achieve just that:
view [
title "Face flags example"
below
toggle "Toggle" [foo/enabled?: not foo/enabled?]
foo: button "Switch" disabled [bar/visible?: not bar/visible?]
bar: base red
]
You can adapt this approach to the task at hand. As I understand, you want to offer mutually exclusive localization options; drop-list might be a good fit for that:
view [drop-list data ["en" "es"]]
You can try this:
Red [Needs: View]
view [
en: button "English" [remove find face/parent/pane en]
es: button "Spanish" [
remove find face/parent/pane en
remove find face/parent/pane es
]
]

New line button && submit button

In my TextInput I need to show a "New Line" key and also the "Done" key.
Currently I am only able to get one or the other. I can get the "New Line" key but setting <TextInput returnKeyType="none" multiline>, however I don't get the "Done" key anymore:
Is it posible to get both? I am testing on Android, I haven't tested on iOS yet.
Unfortunately, the short answer is no.
For the returnKeyType the documentation states can only one of the enum values...
returnKeyType?: enum('done', 'go', 'next', 'search', 'send', 'none', 'previous', 'default', 'emergency-call', 'google', 'join', 'route', 'yahoo')
Determines how the return key should look. On Android you can also use returnKeyLabel.
Cross platform
The following values work across platforms:
done
go
next
search
send
Android Only
The following values work on Android only:
none
previous
iOS Only
The following values work on iOS only:
default
emergency-call
google
join
route
yahoo

Jquery live does not seem to work in nested calls

I am encountering a problem of jquery live function not consistently working for me (or that what I think).
I have the same html form which is used for both adding new comment and editing an existing one; this form is propagated using a php code at the server side through a GET call. The two forms are displayed in two different tabs (tab1: adding a comment, tab2: listing the comments; tab3: edit a comment selected in tab2) based on the tab selection. The "Add comment" form appears as the main content of the tab1; however, the 'edit' form appears based on the selection of the comment that needs to be edit in tab2, so let assume that the "edit comment" form appears as tab3. The below code work perfectly for tab1 when the form is the main content of that tab; but it doesn't work consistently when it is the main content of tab3, which is showed based on which comment need to be edit in tab2.
$("input.sample_radio").live('change',function(){
if ($(this).val() == 'no')
$('#sample_table').hide();
else if ($(this).val() == 'yes')
$('#sample_table').show();
return false;
});
If you can provide me with some thoughts, it would be appreciated. My observations were:
I used $("input[name='sample_radio']") but this didn't work for the form of tab3 because it always end up at the form of tab1
by using $("input.sample_radio") I assumed all the classes of type 'sample_radio' would work, but it not working either.
live is supposed to bind events to the new elements added to the DOM tree after jquery calls, but it seems this is not the case for me.
Thanks
Following the suggestion of Mark Schultheiss
Look into .delegate() which was presented specifically to address this by allowing you to specify a context.
I managed to solve this issue by binding the event to the selected parents (tab1 and tab3) of the radio buttons and then filtering based on the selector which is here is the name of the radio button element and as shown below:
$('#tab1,#tab3').delegate('input[name="policy_radio"]','change',function(){
if ($(this).val() == 'no')
$('.policy_table').hide();
else if ($(this).val() == 'yes')
$('.policy_table').show();
return false;
});
Thanks for pointing me to this point.
By using .live you have ran into one of it's challenges. When you change the selection context you prevent it from working properly.
Look into .delegate() which was presented specifically to address this by allowing you to specify a context.
See this post for some notes on delegate from Brandon Aaron: http://brandonaaron.net/blog/2010/03/4/event-delegation-with-jquery
And see this nice one on context: http://brandonaaron.net/blog/2009/06/24/understanding-the-context-in-jquery

KERN-EXEC 3 when navigating within a text box (Symbian OS Browser Control)

I've had nothing but grief using Symbian's browser control on S60 3rd edition FP1. We currently display pages and many things are working smoothly. However, when inputting text into an HTML text field, the user will get a KERN-EXEC 3 if they move left at the beginning of the text input area (which should "wrap" it to the end) or if they move right at the end of the text input area (which should "wrap" it to the beginning).
I can't seem to trap the input in OfferKeyEventL. I get the key event, I return EKeyWasConsumed and the cursor still moves.
TKeyResponse CMyAppContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
if (iBrCtlInterface) // My browser control
{
TBrCtlDefs::TBrCtlElementType type = iBrCtlInterface->FocusedElementType();
if (type == TBrCtlDefs::EElementActivatedInputBox || type == TBrCtlDefs::EElementInputBox)
{
if (aKeyEvent.iScanCode == EStdKeyLeftArrow || aKeyEvent.iScanCode == EStdKeyRightArrow)
{
return EKeyWasConsumed;
}
}
}
}
I would be okay with completely disabling arrow key navigation but can't seem to do this.
Any ideas? Am I going about this the wrong way? Has anyone here even worked with the Browser Control library (browserengine.lib) on S60 3.1?
Update: Interestingly, if I switch to use Cursor Navigation, it works fine. For now, this is a workaround. I'm still curious to know if there are ways to resolve this.
You would get quicker answer probably in http://discussion.forum.nokia.com/forum/.
Interestingly, if I switch to use Cursor Navigation, it works fine. For now, this is a workaround. I'm still curious to know if there are ways to resolve this. For now, I'm calling this the answer.