Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 116
Registered: ‎03-15-2011
My Device: Blackberry 9800
My Carrier: developer
Accepted Solution

Screen is not scrolling when virtual keyboard is open by clicking on an edit field

Hi,

 

 

I searched and tried a lot but didn't get success.

 

There are three verticalfield managers in my screen.

 

1.)

vfmMain

= new VerticalFieldManager(Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT | Manager.NO_VERTICAL_SCROLL) {

 

protectedvoidpaint(Graphics grphcs) {

 

if(imgBG != null){

grphcs.drawBitmap(0, 0,

imgBG.getWidth(), imgBG.getHeight(), imgBG, 0, 0);

}

super.paint(grphcs);

}

protectedvoid sublayout(int maxWidth, intmaxHeight) {

maxWidth = UIConstants.

SCREEN_WIDTH;

maxHeight = UIConstants.

SCREEN_HEIGHT;

 

super.sublayout(maxWidth, maxHeight);

 

super.setExtent(maxWidth, maxHeight);

}

};

 

2.)

vfmFieldNS

= new VerticalFieldManager(Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT | NO_VERTICAL_SCROLL) {

 

protectedvoidpaint(Graphics grphcs) {

 

if (imgBGCoverInternetHome != null) {

grphcs.drawBitmap((UIConstants.

SCREEN_WIDTH - imgBGCoverInternetHome.getWidth()) / 2, 0, imgBGCoverInternetHome.getWidth(), imgBGCoverInternetHome.getHeight(), imgBGCoverInternetHome, 0, 0);

}

super.paint(grphcs);

}

protectedvoid sublayout(int maxWidth, intmaxHeight) {

maxWidth = UIConstants.

SCREEN_WIDTH;

maxHeight =

imgBGCoverInternetHome.getHeight()/* UIConstants.SCREEN_HEIGHT- (UIConstants.LABEL_HEIGHT + UIConstants.FOOTER_MENU_HEIGHT)*/;

 

super.sublayout(maxWidth, maxHeight);

 

super.setExtent(maxWidth, maxHeight);

 

}

};

 

3)

vfmScroll

= new VerticalFieldManager(USE_ALL_WIDTH | USE_ALL_HEIGHT | VERTICAL_SCROLL) {

 

protectedvoid sublayout(int maxWidth, intmaxHeight) {

maxWidth = UIConstants.

SCREEN_WIDTH;

maxHeight =

imgBGCoverInternetHome.getHeight()-imgButtonFocusBig.getHeight()/2/*UIConstants.SCREEN_HEIGHT - (UIConstants.LABEL_HEIGHT + (UIConstants.FOOTER_MENU_HEIGHT + VERTICAL_GAP))*/;

 

super.sublayout(maxWidth, maxHeight);

 

super.setExtent(maxWidth, maxHeight);

}

};

 

I am addidng all fields in scrollable manager that is vfmScroll.

 

 By clicking on edit field, virtual keyboard opens over the screen, edit field hides and screen does not scroll.

 

 

Please Help.

Thanks in advance.

 

 

 

 

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Screen is not scrolling when virtual keyboard is open by clicking on an edit field

Can I suggest that you try your code using a standard VerticalFieldManager, make sure it works, then try to manipulate the layout of your Fields.

 

I recommend that you review this:

http://supportforums.blackberry.com/t5/Java-Development/How-to-Extend-Manager/ta-p/446749

and this:

http://supportforums.blackberry.com/t5/Java-Development/Create-a-custom-layout-manager-for-a-screen/...

 

Now you appear to be trying to make Managers that use all the screen, in which case I recommend you review this:

http://supportforums.blackberry.com/t5/Java-Development/MainScreen-explained/ta-p/606644

 

Anyway, this is dodgy code:

protected void sublayout(int maxWidth, int maxHeight) {
 maxWidth = UIConstants.SCREEN_WIDTH;
 maxHeight = UIConstants.SCREEN_HEIGHT;
 super.sublayout(maxWidth, maxHeight);
 super.setExtent(maxWidth, maxHeight);
}

You have asked the VFM to layout itself;f in a certain area.  And then you have told it how big it has to be - regardless of how big it determined that it had to be.

 

In addition, you are using this: UIConstants.SCREEN_HEIGHT;

 

Now when the Virtual keyboard is displayed the actual height of the screen is reduced by the size of the keyboard.  However you have told you Manager that it has the full Height, so it probably thinks it does not have to scroll. 

 

Sorry I don't have an immediate answer for you because I do not know what you are trying to do.  But I hope by reviewing the above and setting the height of the screen correctly you will overcome your problem.  If I was to suggest that you change one thing, it would be this:

 

protected void sublayout(int maxWidth, int maxHeight) {
 maxWidth = Math.max(UIConstants.SCREEN_WIDTH, maxWidth);;
 maxHeight = Math.max(UIConstants.SCREEN_HEIGHT, maxHeight);
 super.sublayout(maxWidth, maxHeight);

}

 

 

 

 

Highlighted
Developer
Posts: 116
Registered: ‎03-15-2011
My Device: Blackberry 9800
My Carrier: developer

Re: Screen is not scrolling when virtual keyboard is open by clicking on an edit field

Thanks for the reply Peter. Instead of UIConstants.SCREEN_HEIGHT, Now I am using Display.getHeight()-headerHeight-footerHeight. Since Display.getHeight() is getting calculated accordingly when virtual keyboard is open, so its working fine for me.
Trusted Contributor
Posts: 141
Registered: ‎02-15-2012
My Device: 9800
My Carrier: Airtel

Re: Screen is not scrolling when virtual keyboard is open by clicking on an edit field

This may also useful to me.