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

Reply
Developer
avinash_kumar_ispg_in
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve

Re: To stop scrolling in vertical manager

Hi ankit

 

 My whole screen are not scrolling. and i all ready did what you hve told now.

 

My problem is that

 

While scrolling of first VFM ends the element automatically it goes on first element on  second VFM and second VFM starts scrolling autometically which i dont want.

  I want it to scroll while i navigate through pointer laft and right on each VFM.

  Which is working with GrideFieldManager.

 

Thanks.

Trusted Contributor
ankitagrawal
Posts: 141
Registered: ‎02-15-2012
My Device: 9800

Re: To stop scrolling in vertical manager

Add first vertical field manager to another VFM(NO_VERTICAL_SCROLL), add second VFM to another VFM(NO_VERTICAL_SCROLL). Add these third and fourth VFM to HFM.

Developer
avinash_kumar_ispg_in
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve

Re: To stop scrolling in vertical manager

Hi ankit

 

 Even it is not working means while the second VFM finishing scrolling the first VFM starting to scroll automatically

 

But I need to scroll it while I navigate the pointer left and right on choice.

 

Did you tested it or just gave me idea, if you have tested it can you give me some code sample?

 

Thanks.

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

Re: To stop scrolling in vertical manager

OK, I understand your requirement.

 

In the initial explanation the problem you were having was that both VFMs were scrolling together.  So you scrolled down one and the other scrolled to keep at the same 'level'.  The solution I suggested should have resolved that issue and perhaps it has since you no longer say it is a problem.  It would be nice if you could confirm that,

 

Now you have a different problem, in that when focus moves from one VFM to another, the focus action taken is not what you want.  This is a fairly common problem, typically though people see it with HFMs.  With VFMs and HFMs, when focus moves into the Manager, they will set the focus to the first or last Field in the Manager depending on direction of the movement.  A lot of people what the focus to return to the last selected item.

 

So you need to suppress this behavior in some way.  One option is to override the various focus methods in a manager and retain the 'selected' Field which focus moves back to. 

 

But in your case, probably the easiest way is to make sure that both VFMs do not loose focus on a vertical scroll.  Below is some code that should do that assuming the 'scrolling' you are talking about is being achieved using the track pad.  You should add this to both VFMs to override their standard method. 

 

Note that this code makes the assumption that the first and last Fields in the manager are focusable.

 

Hope this helps:

 

                /**
                * Navigation movement so that we stop at the end when scrolling up and down
                */
                protected boolean navigationMovement(int dx, int dy, int status, int time) {
                        int focusIndex = getFieldWithFocusIndex();
                        if ( focusIndex == 0 && dy < 0 ) {
                                // scrolling up but at beginning
                                return true;
                        }
                        if ( focusIndex == this.getFieldCount() - 1 && dy > 0 ) {
                                // scrolling down but at end
                                return true;
                        }
                        return super.navigationMovement(dx, dy, status, time);
                }

 

Developer
avinash_kumar_ispg_in
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve

Re: To stop scrolling in vertical manager

Hi peter 

many many thanks

  I got solved my problem.