Is there focus and lost-focus event on black berry sdk? - blackberry

I am very new developer for black berry environment. Is there a focus and lost-focus event for the controls which are currently selected or deselected?
Please give me some like or example.
Thank you.

If you are writing your own custom field, or want to catch the events of your Screen class(es), then you would override the virtual Field.onFocus() and Field.onUnfocus() methods.
If you want to catch focus events of other fields, then you have to implement the FocusChangeListener interface and then call the Field.setFocusChangeListener() method of those fields.

Yes, these are Field.onFocus(int direction) and Field.onUnfocus(). Check the API for details.

Related

iOS Extension with transparent background

I would like to add transparency to iOS widget, but it looks like it is not supported by default.
Most widgets are non transparent, but I have an example of transparent one.
That's why I ask you about any tips on how to implement such feature for widgets.
Thanks in advance!
Short answer is you can't (as of iOS 14.5).
Most "pseudo-transparent" non-Apple widgets involve asking the user for the wallpaper they're using, then cropping it accordingly and using the result as a widget's background, creating an illusion of transparency at that exact widget position. This can (and will) break parallax and other such effects.
That is if we're talking WidgetKit, of course; legacy Today widgets may give you a bit more freedom, although you likely won't achieve full transparency without hacks like above.
Vym is right. We just developed a widget app that can implement such a pseudo-transparent effect.
Hoping this might help others who want to achieve such effect.
Here is how:
Guide the user to take a screenshot(with current wallpaper) on a blank home screen, and save it.
Tell the user to provide the widget with the widget position. This can be done via the Siri Intents Extension.
public enum WidgetCropPosition: Int {
case smallTopLeft
case smallTopRight
case smallCenterLeft
case smallCenterRight
case smallBottomLeft
case smallBottomRight
case mediumTop
case mediumCenter
case mediumBottom
case largeTop
case largeBottom
}
Crop the saved wallpaper according to the widget position.
The pain point here is the widget of the same position does don't have the same frame location on different devices. You have to do a lookup the table to find the correct position.
This is a Swift Package that helps to crop the correct frame on different iOS devices.Translucent

Get all elements in the view of iphone app using xcode

I am trying to take screenshot of every screen during iphone app automation on a simulator. Along with the screenshot I also want to extract all strings in the that particular view before taking a screenshot using xcode. Is there a way to do that? Purpose is to send these screenshots and strings for validation to another tool.
This can be done using Web Driver Agent(WDA) provided by facebook. It does provide all the functionalities you need for your app.
Here is link to github repo for it:
https://github.com/facebook/WebDriverAgent
Please have a look at it. It might help you achieving your goal.
If you are using the XCUITest framework for your automation, you can use XCUIScreen.main.screenshot() to get a screenshot of the current state.
To fetch all text currently on screen you can use XCUIApplication().descendants(matching: .textField) or .buttons or .any or whatever you expect to be on the screen, and extract the text from the element
let descendants = XCUIApplication().descendants(matching: .textField)
foreach descendant in descendants { descendant.label /*do something*/ }
You need to set an Accessibility Identifier on the view elements for this to work.

firefox addon sdk override link preview text

I'm new to developing firefox addons and was wondering if there is a way to override/modify the link preview text that appears at the bottom of the browser when you hover over a link.
I've looked briefly and wasn't able to find any reference describing this.
Thanks for any thoughts.
You can set the status text like this:
aDOMWindow.XULBrowserWindow.setOverLink('blah')
Where aDOMWindow is a window like that returned from for example Services.wm.getMostRecentWindow('navigator:browser').
So like do link.addEventListener('onmouseenter'.... a function that does setOverLink
and to make it go away set it to blank string. So just window.XULBrowserWindow.setOverLink('')
But you are doing this on mouse enter of a link and by default mouse out of links will blank it so you may not neede to handle blanking it.
edit:
you asked about add-sdk, so the Services.wm.getMostRecentWindow might not make sense, so here's a quick test you can try in sdk:
const { getMostRecentBrowserWindow } = require('sdk/window/utils');
getMostRecentBrowserWindow().XULBrowserWindow.setOverLink('hiiiiiii!!!')

Release Event Handler?

Maybe I'm just over thinking this, but is there a way to capture when the user let's go of a button with iOS? So to pose my question better: I have a button on the screen, and when the user let's go of it, I want to call an event. Is there a way to do that?
Try to answer, I wonder the same idea too..
From Apple Document : UIControl Class
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIControl_Class/Reference/Reference.html
My Idea sub-class UI Control using following Task :
– beginTrackingWithTouch:withEvent:
– continueTrackingWithTouch:withEvent:
– endTrackingWithTouch:withEvent:
– cancelTrackingWithEvent:
Put a BOOL isBegin = YES at beginTrackingWithTouch to know that it was touched..
Then when endTrackingWithTouch happen (which is the user end touching the control), do what you going to do in there then set isBegin back to NO
regards,
FHW

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