Blackberry: Using SpinboxField Control in a Non-touch Device (navigation problems) - blackberry

I'm a newbie in blackberry development and stuck on a code section regarding the Spinboxfield and non-touch devices. I will appreciate any help, code sample reply or links to relevant tutorials that shows how to use the spinboxfield on a non-touch device (e.g. a blackberry curve or a bold 3). The problem occurs when a screen contains a spinfield and another control e.g.button. Scrolling from the spinboxfield to the button is quite impossible cos once the user enters the spinboxfieldmanager area, they are unable to navigate to the button control and the user is stuck within the spinboxfield control. I have tried the code "SpinBoxFieldManager.setClickToLock(false)" but this doesn't work. Example code is shown below
// an array of choices for the months.
final String[] MONTHS = { "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"};
// an array of choices for years
final String[] YEARS = { "2001", "2002", "2003", "2004", "2005", "2006", "2007",
"2008", "2009", "2010", "2011", "2012", "2013", "2014"};
// use a text spin box to display these choices
SpinBoxField monthSpinBox = new TextSpinBoxField(MONTHS);
SpinBoxField _yearsSpinBox = new TextSpinBoxField(YEARS);
// create a manager for these spin boxes
SpinBoxFieldManager spinBoxManager = new SpinBoxFieldManager();
// add the spin boxes
spinBoxManager.add(monthSpinBox);
spinBoxManager.add(yearsSpinBox);
spinBoxManager.setClickToLock(false);
this.add(spinBoxManager);
ButtonField mybutton = new ButtonField("MY Button", ButtonField.CONSUME_CLICK);
mybutton.setChangeListener(this);
this.add(mybutton);
Apparently using the keypad to scroll from the spinboxfield to the button is impossible except on touch devices.
Thanks in advance.

http://docs.blackberry.com/en/developers/deliverables/24222/Spin_boxes_887725_11.jsp
Best practice:
...
Avoid using a spin box if several other components appear on the screen.
I would use a popup-screen to display the spin box, as the image on the page suggests.

Related

Appium fails to locate element off-screen using UiSelector

I'm starting to automate a test suite for a mobile app coded in NativeScript (it used to be a hybrid Cordova app) and it's proving difficult to locate some elements.
I'm trying to locate a TextView widget that's outside of the visible screen space (AKA viewport) using UiSelector:
#AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"CFT\")")
private MobileElement labelCFT;
When I try to interact with such element, the result is the following message:
org.openqa.selenium.NoSuchElementException: Can't locate an element
by this strategy: By.chained({By.AndroidUIAutomator:
new UiSelector().textContains("CFT")})
The logic conclusion would be that the element does not exist or my locator strategy is faulty. But here is the thing, when I change the text to find for that of an element that's inside the visible space/viewport, the locator works flawlessly. Example:
#AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"loans\")")
private MobileElement labelCFT;
And then:
public void whatText() {
System.out.println("Text of the label: " + labelCFT.getText());
}
I get the correct "Text of the label: These are your loans".
Apparently, it's a limitation of the UiSelector or at least the way Appium works with it.
The only option I imagine is to scroll the whole screen and then trigger #AndroidFindBy, then repeat until there's no scroll left.
Is this suppose to be how UiSelector and textContains() work?
Is it another solution for this?
Many thanks.
I have faced similar type of problems in automation. The only way around I found was to scroll up or down till the element is visible on screen and then access the element by "name". you can use the following command for scrolling.
driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Your Element\"));");
After your desired element is visible on the screen you can access that element easily.
Thanks
In Android App you can only click or do any actions on the elements which are visible on the screen if you want to perform any actions on element which are not visible you can use touch action method where you need to specify x and y cordinated i think this might help you in my case this works
TouchAction ta = new TouchAction(driver);
ta.press(PointOption.point(207, 582)).moveTo(PointOption.point(8, -360)).release().perform();

UI5 highlight issue

I am confused with the selection & highlight with UI5 controls on mobile touch devices, such as IPad. As far as I know, sap.m.Text is supported to be highlighted, but for other controls like "sap.ui.core.HTML", it is not.But I just cannot highlight or select them in iPad or Win8 touch devices.
Just to make it clear, what I mean is when you "long press", in other words, "tap hold", the selection frame of Safari, e.g.,will not come out. Is there anything missing ?
Is there anyway to achieve this?
For controls that don't support the taphold event you can extend them.
You could use jQuery's taphold event.
So, a pattern like this:
onBeforeRendering: function() {
this.$().off("taphold");
},
onAfterRendering: function() {
this.$().on("taphold", function(e) {
// custom behavior
});
}

Is there a way to specify an order of toolbars using Mozilla add-on sdk?

Our app is using 1+ toolbars written using add-on sdk. The problem is, right now the toolbars seems to decide for themselves in which order they will get displayed. In the first window I have toolbar A below toolbar B. However, if I open a new window, toolbar B will be on top.
Anybody else encountered this issue? Do you guys have any tips on how to deal with it?
Thanks!
Luka
EDIT: attaching a code that shows how I create toolbars:
this.myframe = new ui.Frame({
url: self.data.url(this.LABELS.TRANSLATION_FRAME)
});
this.mytoolbar = ui.Toolbar({
title: this.NAME,
items: [this.myframe],
hidden: true
});
The second toolbar has the same three arguments (title, items, hidden) and both frames contain a properly structured, very minimal html files.
These toolbars reside in two separate extensions. If both are enabled, as I mentioned above, the ordering seems to be pretty random.

Xcode/Objective-C implementing a players turn toggle

I'm new to the whole VCM programming structure and more specifically to objective-c.
Right now i'm working on an iOS app that is like the game "connect 4." This Xcode project is my practice project that i've been using to play around/learn how to make iOS apps so there are several files and lots of commented out code, so Ill try my best to provide the necessary content from my project.
App State:
Right now I have a 10x10 grid of blue square/buttons. I'm still in the early stages of implementing the functionality of the game. Rather than making each square its own button, I created 10 frames and 10 buttons. Each row is a single button, which is broken up into 10 squares.
I currently have the squares change their color to red and become disabled once clicked. If I click multiple times.. the squares turn red when pressed. Heres a screenshot example run:
What Im wanting to do:
I want to build off of what I have, but not exactly sure how to keep track of which "players turn" it is. For example.. I want the first clicked square to turn red, representing player1's move. I want the second click to turn the button, say green, representing player2's move.. then the next move will be player 1's move.
I know Ill have to make sure the button is/was ENABLED and valid before switching which players turn it is.
How should I go about doing this? This is more of a general question, but I'll provide needed code snippets if necessary. Thanks!
In your .h file add an integer (variable)
int Turn = 1;
In your .m file you can do:
if(Turn == 1)
{
// Player one is playing
Turn = 2;
}
else if(Turn == 2)
{
// Player two is playing
Turn = 1;
}

PhoneScreen problems with incoming call

I want to add a field to the Phone Screen when a screen is received. I successfully made this using the following code:
public void callIncoming(int callId) {
PhoneScreen ps = new PhoneScreen(Call, UiApplication.getApplication());
PhoneScreenHorizontalManager manager = new PhoneScreenHorizontalManager();
LabelField label = new LabelField("Call Received");
manager.add(label);
ps.add(manager);
ps.setScreenBackground(Color.RED);
ps.sendDataToScreen();
}
I tried this code on the following devices:
BB Mini Curve, Bold 4, Bold 2 and Curve and this works like a charm with all the functionality I want. A background colored red is appearing in the area where I can draw fields
I tried it on these phones and the label field did not appear: Torch, Bold3
On these phones, When I add data to the screen, I guess that these fields are appearing below the ringer off notification. With these devices, no Background is appearing... So this is a main issue.
How to solve this and make the fields appear on these phones too?
Thanks in advance
I don't have the answer, but have started a thread here:
http://supportforums.blackberry.com/t5/Java-Development/PhoneScreenDemo-not-displaying-information-on-os6/m-p/1450769#M184811
I've opened a RIM ticket and will share info as I get it.
As far as I can see PhoneScreen has big issues and is not consistently supported across devices.
Using isSupported() will only determine if the device screen type supports the API, (SVG is required according to RIM Jira ticket), not if it will actually work.

Resources