Join Our 3 MILLION+ Members Today! Register Here | Login
Go Back   BlackBerry Forums at CrackBerry.com > BlackBerry Professionals > App Developers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
    Thread Author   #1  
Old 05-23-2011, 09:37 AM
CrackBerry Newbie
 
Join Date: Apr 2011
Posts: 4
Likes Received: 0
Thanked 0 Times in 0 Posts
Default Blackberry embedded browser blocks a focus

I've got a problem with a Blackberry embedded browser which can be found since 5.0 API. Under "Embedded browser" I mean a situation where I add a few fields to a class which extends the MainScreen class. In a nutshell it looks like a following code:
Code:
public class ScreenReg extends MainScreen {

public ScreenReg () {
	BitmapField header = new BitmapField (IMG_HEADER);
	add(header);

	BrowserField browser = new BrowserField ();
 	add (browser);
        browser.setFocus();
 
        ButtonField button = new ButtonField ("Submit", Field.FIELD_BOTTOM | Field.FIELD_HCENTER);
	add (button);
}

	protected boolean navigationMovement (int dx, int dy, int status, int time)
	{
		return super.navigationMovement (dx, dy, status, time);
	}

(...)
}
Please note that the browser is focused. Inside the constructor I added a following piece of code:
Code:
        browser.addListener (new BrowserFieldListener ()
        {

              public void documentLoaded (BrowserField browserField,
                      Document document)
              {
                         synchronized (UiApplication.getEventLock ())
                         {
                               if (url.equals( "htp://example.com/last.php"))
                               {
                                   ScreenRegFlow2.this.add(buttonSync);
                              	   buttonSync.setFocus ();
                               }
                         }
        });
The reason behind that is I want a button to appear on the v. bottom of a screen once the browser reaches an URL
"http:/example.com/last.php"
Everything goes fine, I add a button, it is focused (so the browser loses its focus). The problems start, being focused on the button as I moved UP to the browser, the browser gets focused. Since then every event of UP/DOWN is forwarded directly to the browser, so I'm able to scroll through any website,,, but I can't get back to the button. It simply doesn't get focused any more. Getting completely down in the browser makes the browser contents scrolled to the bottom but doesn't move a focus on a button...

do you have any idea how can switch the focus between a browser and a button in that particular case?

thanks in advance
Reply With Quote Tip this Post
Reply
BlackBerry Forums at CrackBerry.com > > BlackBerry Professionals > App Developers   Blackberry embedded browser blocks a focus

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes