setHorizontalScroll

Hi all

I tried to find how to use the setHorizontalScroll() method, but it seems to not work in anyway I try.

When I call setHorizontalScroll(100,true);  My HorizontalFieldManager is always the same

and when I call getHorizontalScroll();   It returns 0

I'm not sure "setHorizontalScroll (int position, boolean lively) is the method that automatically slides HFM to position when animate is set to true.

But if this is the case, I still don't know how to use it

It would be really nice if someone told me how to use it

I thank you very much.

tklanilkumar wrote:

It will work...

According to my concern it willn't give you the effect of what you expect if you override the (de) touchEvent...

you override the touchEvent (). ?

touchEvent has nothing to do with it. New - you can check if setHorizontalScroll throws exceptions? It would be the most likely explanation why it does nothing.

Is your broad Manager (virtual width, that is) also - need to scroll? Have HORIZONTAL_SCROLL style bit set?

Tags: BlackBerry Developers

Similar Questions

  • BlackBerry OS 6.0: ScrollView.setHorizontalScroll () does not work

    In OS 6.0, we now have a ScrollView http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/ui/ScrollView.html

    However, I was faced with the following problem:

    manager.setHorizontalScroll (15);

    int x = manager.getHorizontalScroll)

    at the end x = 0;

    Does anyone else have this disorder?

    The problem is resolved. I do not call setVirtualExtent() during sublayout(). In 5.0 and below which works very well, but in 6.0 it is buggy.

  • How to set horizontal scrolling to horizontal field Manager when fields are added using a loop for?

    The following code snippet contains a horizontal field Manager to which are added five buttons.

    1. I can't the value of horizontal scrolling to horizontal management Manager because of who I am not able to access the keys 4 and 5.

    2. usually, we put horizontal scrolling in the following way:

    container = new HorizontalFieldManager(USE_ALL_WIDTH|HORIZONTAL_SCROLL|HORIZONTAL_SCROLLBAR);
    

    3. so I also tried setting of horizontal scrolling in the following way

       container = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL|Manager.HORIZONTAL_SCROLLBAR)
                {
    
                    protected void sublayout(int maxWidth, int maxHeight) {
    
                        Field field = null;
                        int x = 0;
                        int y = 0;
                        int maxFieldHeight = 0;
                        int maxFieldWidth = 0;
                        for (int i = 0; i < getFieldCount(); i++)
                        {
                            field = getField(i);
                            layoutChild(field, maxWidth, maxHeight);
                            setPositionChild(field, x/*width-field.getWidth()*/,y);
    
                            x+=field.getWidth();
    
                            maxFieldWidth = maxFieldWidth + field.getWidth();
                            System.out.println("field width"+field.getWidth());
                            System.out.println(" max field width"+maxFieldWidth);
    
                            if(i==0)
                            {
                                maxFieldHeight = field.getHeight(); // height set of the first button since all components have the same height
                            }
                        }
                        System.out.println("final max field width"+maxFieldWidth);
    
                        setExtent(maxFieldWidth, maxFieldHeight);
    
                    }
                };
    

    but it's not working.

    4 I found this property: (position) horizontalFieldManager.setHorizontalScroll; that contains the parameterioo where the post is supposed to be the new horizontal scroll position. I tried passing the coordinate x of horizontal field Manager, but it does not work. I should pass as a parameter position?

    HorizontalFieldManager container = new HorizontalFieldManager()
    {
        protected void sublayout(int maxWidth, int maxHeight)
        {
            Field field = null;
            int x = 0;
            int y = 0;
            int maxFieldHeight = 0;
            for (int i = 0; i < getFieldCount(); i++)
            {
                field = getField(i);
                layoutChild(field, maxWidth, maxHeight);
                setPositionChild(field, x,y);
                x+=field.getWidth();
                if(i==0)
                {
                    maxFieldHeight = field.getHeight(); // height set of the first button since all components have the same height
                }
            }
    
            setExtent(Display.getWidth(), maxFieldHeight);
    
        }
    };
    
    ButtonField button1 = new ButtonField("Button1");
    ButtonField button2 = new ButtonField("Button2");
    ButtonField button3 = new ButtonField("Button3");
    ButtonField button4 = new ButtonField("Button4");
    ButtonField button5 = new ButtonField("Button5");
    
    container.add(button1);
    container.add(button2);
    container.add(button3);
    container.add(button4);
    container.add(button5);
    
    add(container);
    

    Need your valuable comments and suggestions. Please help me.

    I think that there is a bug in the sublayout (your HorizontalFieldManager 0 mode.  Given that the code did what I think WHAT HFM will do anyway, I recommend that you try to do this with a standard HFM, using this style:

    Manager.HORIZONTAL_SCROLL | Manager.HORIZONTAL_SCROLLBAR

    Let us know how you go.

    When I have more time I'll explain the bug, but if you want to investigate something, be aware that the maximum size that you can use in setExtent are the values that are passed to sublayout.  Compare the width as you try to define in setExtent whose width is increased.

  • dominant touch event handler replaces all other fields

    I have the code following, which uses gestures to perform scrolling on my hfm, but substitution of this hfm, replace essentially all fields on the screen, making them useless. How is this possible, I thought that this specific touchEvent belonged to the hfm? How to work around this problem and just disable scroll for the hfm?

    gallery = new CustomHFM(){
    
                protected void sublayout(int maxWidth, int maxHeight){
                    super.sublayout(maxWidth, 200);
                    setExtent(maxWidth,200);
                }
    
                protected boolean touchEvent(TouchEvent message){
    
                    int eventCode = message.getEvent();
    
                    if(eventCode == TouchEvent.GESTURE){
                        System.out.println("SWIPE GESTURE");
                        TouchGesture g = message.getGesture();
                        int gesturecode = g.getEvent();
                        int direction = g.getSwipeDirection();
    
                            //gallery.setHorizontalScroll(page_two, true);
                        if(direction == TouchGesture.SWIPE_WEST)
                            slideNext();
    
                        if(direction == TouchGesture.SWIPE_EAST)
                            slidePrev();
    
                        pressed = true;
                    }
    
                    if(eventCode == TouchEvent.UP){
                    pressed = false;
    
                    //slide();
                    }
    
                    return true;
                }
            };
    

    I want to just do not use the default scroll and do my own thing! Any suggestion would be appreciated, I'm really in the fire right now.

    OK, this is a different problem.  I suspect that you must reject touch events that are not actually within your HFM.  Then add code like the following at the beginning of your touchEvent method:

    int x = message.getX (1);
    int y = message.getY (1);
    If (x < 0="" ||="" y=""> < 0="" ||="" x=""> getExtent () .width: y > getExtent () .height) {}
    Outside the scope
    Returns false;
    }

    If this is not enough, so be sure that your touchEvent method is called.  If it really is, then I think you have a problem with a Manager.  You have all Directors complicated on your screen.  Try to simplify the screen so that you don't use native components RIM (and nothing implying positioning as AbsoluteFieldmanager and see if the problem persists.)  If so, then see if you can post an example of the sample that shows the problem so that we can all try.

  • Swipping effect as app world application

    Hello..

    I want to show my screen effect swipping left-right as the home screen in torch with app world. Any API for this?

    Anyone got the idea?

    Thank you.

    The only way I know to achieve this is to have two different screens in a HorizontalFieldManager, make sure that both are limited by the width to 1 width of the device, then use horizontal scrolling (setHorizontalScroll()) to move the scroll position in the HorizontalFieldManager in some kind of loop timer.

    I'm sure there are other ways, but that's what I would try first.

  • effect of animation for horizontal field Manager

    Hello
    I have three willing fieldManagers horizontally in the content of

    average fieldmanager will change on click of a button

    is it possible to apply slide in French - sliding effect to these content?

    I don't want to do the new screen n again?

    Wrap the Middle Manager in a HorizontalFieldManager (HORIZONTAL_SCROLL). When you want to remove the old content and slide into the new, follow these steps:

    (1) adds the new content the HFM;

    (2) an animation slide to the left edge of the old content (probably 0) up to the left edge of the new (getLeft() returns). Use the method suggested by Peter;

    (3) once the animation finished, remove old content and setHorizontalScroll on the HFM wrapping to 0 (since the new content now starts it).

  • How to develop BlackBeery Ui

    I want to develop the UI for a screen which I join... on ehelp me please to write code for the user interface

    akhilmuppa wrote:

    Main box is a text box, and it will scroll vertically and horizontally...

    Yes, really, I have problem with header, I've tried in many ways with many managers, but it does not display the two textfielld and button .so please help me solve this problem... As I referred to it a few docs but I force get the solution

    OK, then you create your screen with both VERTICAL_SCROLL and HORIZONTAL_SCROLL flags. The main area Manager (which is not directly visible to you if you can get the reference through getMainManager) is a VerticalFieldManager, so it will hold the fields vertically (duh!). However, thanks to the HORIZONTAL_SCROLL indicator, it will allow wider than the screen fields to get what they want and will be able to scroll horizontally - either programmatically (setHorizontalScroll) or 'naturally' when the focus moves outside the visible area.

    As for the problem with the textfield and button, there are two ways to solve it.

    For example, if you searched "width-hungry" as I suggested, you would have found, for example, this thread:

    EditField and checkboxfield on the same line

    Take a look at the solution - it's one of the ways to do so: simply create a field that will be limited to how much of the piece.

    The second solution would be to create a Manager customized for this particular configuration of TextField left and ButtonField right. The Manager will always have exactly two fields, in this exact order, so you can write his sublayout invoking it.

    So, what does ' protected void sublayout (int maxWidth, maxHeight) ? It does the following things:

    (1) receives the maximum width and height it can occupy in the parent Manager (see maxWidth and maxHeight parameters);

    (2) tells the Manager (managed fields) how room child within this handler they can get (using layoutChild (child of field, int height, int width)). After that (and only after that) he knows how this child will be actually using child.getExtent (any form) or (if you want width and height separately) child.getWidth()/child.getHeight (). It is normal that any Manager to expose a child, get its dimensions, adjust the width and height according to the remaining information then continue carrying the children in the same way.

    (3) positions of its children using the setPositionChild (child field, int x, int y) call. Positions are relative to its upper-left corner (which is (0,0)).

    (4) calculates the height and width that result and sets using setExtent (int width, int height).

    Try to write the handler using these data as well as the link provided Simon and come back here if you still have problems. By the way, take a look at sublayout to JustifiedEvenlySpacedHorizontalFieldManager for a good example.

  • A pointer that moves when the user navigates screen

    I have a screen that contains different fields/images. Some of them are focusable and others are not. Is it possible to print/display an arrow pointer that moves as the user moves the wheel?  And the arrow pointer can be on the oilfields focusable and non-focus when the user stops and wheel.  It's like the pointer inside of a browser (office or by phone).

    Is there a simple way to do this, or it will be complicated in a way...

    Thank you

    Man

    Complicated enough without doubt.

    You can override moveFocus() to set the position of the cursor. You need to avoid moving focusable developed by calling fields do not super.moveFocus (). If you want to set focus when you click, you could get the cursor position and then go the extra fields and call XYRect.contains(x,y) with their Field.getExtent ().

    When scrolling you have to make sure the cusror is visible by calling setVerticalScroll(), setHorizontalScroll(), or maybe just Screen.scroll ().

  • Scrolling table

    Hello, I have a problem.

    My friend and I have created a table.

    It looks like this:

    However, we want different sections to scroll independently. For example, you can already guess, we want the time to scroll vertically when cells move vertically but not when they move horizontally. And we want the days to scroll horizontally with the cells, but not vertically. In my head that managers overlap or something. Any suggestions please?

    Don't you worry your companion in mind. I managed to do the work. I just changed the listener of scrolling. and the managers to which I applied to them. I added only the earpiece scrolling to the administrator who had the main editable cells and the code looks like this

    ....


    public void scrollChanged(Manager, int verticalChange, int horizontalChange)
    {
        (The manager I wanted to scroll vertically).setVerticalScroll(verticalChange);
        (The manager I wanted to scroll horizontally).setHorizontalScroll(horizontalChange);
    
    }//Voila it works!
    

     
    Thank you for everything. You really helped to guide me on the right track

  • Confirming a design where I need to save where the user navigated to the screen.

    A matter of design, which is a good implementation of the following?

    I need to be able to save the location of the place where the user has scrolled, then when the user:

    1. Changing screens and returns to the previous screen.
    2. The application farm (moves the application at bottom) and opens the app again (move the app in the foreground).

    The user scrolls automatically here where the user was before.

    For example, if I have a VerticalFieldManager with the following text read only fields:

    • LabelField
    • LabelField
    • LabelField
    • LabelField
    • LabelField
    • ButtonField

    The user scroll down to the third LabelField — two actions user above performs, returns to the screen, and scrolls down to the third TextField again.

    Is the hardest part, I can't count on own dirty, muddy, or fields because it is read only the data and a ButtonField.

    I can't use Manager.setFocus because the fields have an accent.

    I think I can use Manager.setHorizontalScroll and Manager.getHorizontalScroll, but is there a better way?

    Not sure that your arguments to change my suggestion.

    "The user must be able to close the application."

    If they close the applciation that they lose their position.  It happens in most of the applications.  Browsers do not open up on top of the page you were viewing when you close, for example.

    "The user must be able to request the application thoroughly using the end key of red color"

    You will not be able to stop this.  It will just happen.  Nothing for you to do.

    "This is a pile of high display a screen where the Menu button is the main navigation.".

    This does not preclude that I proposed either possible.  If you pop a screen and then later push it, my understanding (and experience) are that he's going to be redisplayed as it was when you jump it.  The screens are objects, they don't stop screens just because they aren't on the stack of the screen.

    Also, I see no problem in what you descrtibed for a touchscreen device.

  • Use the scrolling Vertical and Horizontal

    Hi all, I am new to BB. I tried to do a manager can scroll through both vertical and horizontal. I want to do a Picture Manager only a BitmapField, where the BitmapField have width and height more than display, and the Manager could scroll through both vertical and horizontal, so I can't look at BitmapField.

    I read and try to do something like this ( http://supportforums.blackberry.com/t5/Java-Development/How-to-make-Vertical-and-Horizontal-scroll-o... ) and this one ( http://208.74.204.192/t5/Java-Development/How-can-i-use-both-of-horizontal-scroll-and-vertical-scrol... ) but it does not work

    in general I want to do something like ZoomScreen (I do not use zoomscreen, because I can not add the button or another field in this thing).

    I have try this one too, but nothing...

    BEGIN

    public myScreen() {}

    _Image = new VerticalFieldManager VerticalFieldManager (Manager.VERTICAL_SCROLL |) Manager.HORIZONTAL_SCROLL) {}
    protected void moveFocus (int x, int y, int status time int) {}
    setVerticalScroll (y);
    setHorizontalScroll (x);
    super.moveFocus (x, y, status, time);
    };
    };

    B=Bitmap.getBitmapResource("img/edit.jpg bitmap image");
    BitmapField bi = new BitmapField (b, BitmapField.USE_ALL_WIDTH);

    _image. Add (BI);
    Add (_image);

    }

    END

    Thanks for the reply... and sorry for my bad English (Not My Mom Language;-D)

    Welcome to the forums!

    USE_ALL_WIDTH first, remove your BitmapField constructor - as is, it will become monstrously huge (a width of Integer.MAX_VALUE > 1). A default constructor is sufficient. You may need to add FOCUSABLE style according to your needs.

    Second, your moveFocus method is quite useless, because it is called only on touchscreen devices when the user touches that particular place. Touchscreen can already reach moving-scroll and swipe scrolling, so your problem is automatically solved it. In addition, moveFocus is a call relatively high level - all of these calls work well on a screen with many focusable fields and other things.

    You will need to substitute navigationMovement for the BitmapField if it is FOCUSABLE or the screen itself. If you want other fields on the screen, this task becomes really not negligible, so formalize the specs for this screen as much as you can before you implement it. When you have an exact plan, write here, if you still need help.

  • Roller smooth

    Hello

    Please how can I do a scroll smoothly. I have a HorizontalFieldManager I try adding some VerticalFieldManager using full width appear, I want to display the next VerticalFieldManager when scrolling user as the Launcher of the iphone.

    I tried this ground but this doesn't work:

    hfm.setScrollListener (new ScrollChangeListener() {}
                
    ' Public Sub scrollChanged (Manager, int newHorizontalScroll,
    {int newVerticalScroll)
    int fieldIndex = hfm.getFieldAtLocation (newHorizontalScroll + getScreen () .getWidth (), 0);
    hfm.getField (fieldIndex) .setFocus ();
    System.out.println("***fieldIndex"+fieldIndex);
    Invalidate();
    HFM. Invalidate();

    }

    also I tried, but I'm going into an infinite loop

    hfm.setScrollListener (new ScrollChangeListener() {}

    If (!.) MY_CHANGING_SCROLL) {}
                            
    MY_CHANGING_SCROLL = true;
                        
                       
    If (Math.abs (lasthorizontalScroll - newHorizontalScroll) > (getScreen () .getWidth () / 5))
    {
    If (lasthorizontalScroll<>
    {

    If (inPage<>
    inPage ++;
    hfm.setHorizontalScroll (inPage * getScreen () .getWidth (), true);
                               
                               
    }
    else {}
                               
    if(inPage>0)
    -inPage;
                                
    hfm.setHorizontalScroll (inPage * getScreen () .getWidth (), true);
                              
    }
                            
    lasthorizontalScroll = inPage * getScreen () .getWidth ();
    }
    on the other
    {

    return to the last position so she stilll in the page of some
    hfm.setHorizontalScroll (lasthorizontalScroll);
                          
    }
    MY_CHANGING_SCROLL = false;

    Search the Forum, this subject has been discussed in depth, with too many results to post with certainty as one answer.

  • iLLEGALARGUMENT EXception on touch event

    package mypackage;
    
    import java.util.Vector;
    
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FocusChangeListener;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.TouchEvent;
    import net.rim.device.api.ui.TouchGesture;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.XYRect;
    import net.rim.device.api.ui.component.BasicEditField;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.component.SeparatorField;
    import net.rim.device.api.ui.component.Status;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class PlaylistTab extends MainScreen  implements FocusChangeListener{
    
        private int _xCoord = 0; //The x coordinate for the top left corner of the image.
        private int _yCoord = 0; //The y coordinate for the top left corner of the image.
        private int _xTouch = 0; //The x coordinate of the previous touch point.
        private int _yTouch = 0; //The y coordinate of the previous touch point.
    
        private LabelField tab1;
    
        private LabelField tab2;
    
        private LabelField tab3;
    
        private LabelField spacer1;
    
        private LabelField spacer2;
    
        private VerticalFieldManager tabArea;
    
        private LabelField tab1Heading;
    
        private BasicEditField tab1Field1;
    
        private BasicEditField tab1Field2;
    
        private LabelField tab2Heading;
    
        private BasicEditField tab2Field1;
    
        private BasicEditField tab2Field2;
    
        private LabelField tab3Heading;
    
        private BasicEditField tab3Field1;
    
        private BasicEditField tab3Field2;
    
        private VerticalFieldManager tab1Manager;
        private VerticalFieldManager tab2Manager;
        private VerticalFieldManager tab3Manager;
        int tabNum = 1;
        public PlaylistTab()
        {
            super(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR);
            //HorizontalFieldManager hManager = new HorizontalFieldManager();
            HorizontalFieldManager hManager = new HorizontalFieldManager(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR | NO_HORIZONTAL_SCROLL  | NO_HORIZONTAL_SCROLLBAR);
            Font font = getFont().derive(Font.PLAIN, 35);
            tab1 = new LabelField("Songs", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT)
            {
                protected boolean navigationClick(int status,int time){
    
                    return true;
                }
                protected void layout(int width, int height) {
                    super.layout(width, height);
                    //    this.setExtent(this.getWidth(), 60);
                    this.setMargin( ( getHeight() - this.getPreferredHeight()), 0, 0, (getWidth() - this.getPreferredWidth()));
                }
            };
            tab2 = new LabelField("Album", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT)
            {
                protected boolean navigationClick(int status,int time){
    
                    return true;
                }
                protected void layout(int width, int height) {
                    super.layout(width, height);
                    //    this.setExtent(this.getWidth(), 60);
                    this.setMargin( ( getHeight() - this.getPreferredHeight()), 0, 0, (getWidth() - this.getPreferredWidth()));
                }
            };
            tab3 = new LabelField("Artist", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT)
            {
                protected boolean navigationClick(int status,int time){
    
                    return true;
                }
                protected void layout(int width, int height) {
                    super.layout(width, height);
                    //    this.setExtent(this.getWidth(), 60);
                    this.setMargin( ( getHeight() - this.getPreferredHeight()), 0, 0, (getWidth() - this.getPreferredWidth()));
                }
            };
            spacer1 = new LabelField(" | ", LabelField.NON_FOCUSABLE);
            spacer2 = new LabelField(" | ", LabelField.NON_FOCUSABLE);
    
            tab1.setFocusListener(this);
            tab2.setFocusListener(this);
            tab3.setFocusListener(this);
            hManager.add(tab3);
            hManager.add(spacer1);
            hManager.add(tab2);
            hManager.add(spacer2);
            hManager.add(tab1);
    
            add(hManager);
            add(new SeparatorField());
    
            tab1Manager = new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR );
            tab2Manager = new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR );
            tab3Manager = new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR );
    
            tabArea = displayTab3();
            add(tabArea);
    
        }
        public void focusChanged(Field field, int eventType) {
            if (tabArea != null) {
                if (eventType == FOCUS_GAINED) {
                    if (field == tab1) {
                        System.out.println("Switch to Tab 1");
                        delete(tabArea);
                        tabArea = displayTab1();
                        add(tabArea);
                    } else if (field == tab2) {
                        System.out.println("Switch to Tab 2");
                        System.out.println("Switch to Tab 1");
                        delete(tabArea);
                        tabArea = displayTab2();
                        add(tabArea);
                    } else if (field == tab3) {
                        System.out.println("Switch to Tab 3");
                        System.out.println("Switch to Tab 1");
                        delete(tabArea);
                        tabArea = displayTab3();
                        add(tabArea);
                    }
                }
            }
    
        }
    
        public VerticalFieldManager displayTab1() {
            try
            {
                tabNum = 3;
                final VerticalFieldManager Content= new VerticalFieldManager(Manager.USE_ALL_WIDTH|Manager.VERTICAL_SCROLL);
                Content.setMargin(5,0,0,0);
                int mas  = 0 ;
                Vector oleg = new Vector();
                SQLManager poligs = new SQLManager();
                poligs.getSongDownload(oleg, 0);
                while(mas < oleg.size())
                {
                    Song temp = (Song) oleg.elementAt(mas);
                    Content.add(new A_Song(temp.songId, temp.songName, false,temp.albumCover,temp));
                    mas++;
                }
                tab1Manager.deleteAll();
    
                HorizontalFieldManager topManager = new HorizontalFieldManager()
                {
                    public void paint(Graphics graphics)
                    {
                        graphics.setBackgroundColor(0x00000000);
                        graphics.clear(); super.paint(graphics);
                    }
                    protected void sublayout( int maxWidth, int maxHeight )
                    {
                        int width = Display.getWidth();
                        int height = this.getPreferredHeight();
                        super.sublayout( width, height);
                        setExtent( width, height);
                    }
                };
                CustomTextBox editField = new CustomTextBox();
                int pol = Display.getWidth() / 2;
                editField.setWidth(pol);
                ButtonField button = new ButtonField("Search");
                topManager.add(editField);
                topManager.add(button);
    
                //  tab1Manager.add(topManager);
                tab1Manager.add(Content);
            }
            catch(final Exception e)
            {
    
                e.printStackTrace();
                System.out.println("------------------- ");
            }
            return tab1Manager;
        }
    
        public VerticalFieldManager displayTab2() {
            try
            {
                tabNum = 2;
                final VerticalFieldManager Content= new VerticalFieldManager(Manager.USE_ALL_WIDTH|Manager.VERTICAL_SCROLL);
                Content.setMargin(5,0,0,0);
                int mas  = 0 ;
                Vector oleg = new Vector();
                SQLManager poligs = new SQLManager();
                poligs.getSongDownloads(oleg, 0);
                while(mas < oleg.size())
                {
                    Albums temp = (Albums) oleg.elementAt(mas);
                    Content.add(new A_Album(temp.albumId, temp.albumName, false,temp.albumCover,temp));
                    mas++;
                }
                tab2Manager.deleteAll();
                tab2Manager.add(Content);
            }
            catch(final Exception e)
            {
    
                e.printStackTrace();
                System.out.println("------------------- ");
            }
            return tab2Manager;
        }
    
        public VerticalFieldManager displayTab3() {
            try
            {
                tabNum = 1;
                final VerticalFieldManager Content= new VerticalFieldManager(Manager.USE_ALL_WIDTH|Manager.VERTICAL_SCROLL);
                Content.setMargin(5,0,0,0);
                int mas  = 0 ;
                Vector oleg = new Vector();
                SQLManager poligs = new SQLManager();
                poligs.getSongDownloadss(oleg, 0);
                while(mas < oleg.size())
                {
                    Artist temp = (Artist) oleg.elementAt(mas);
                    //Content.add(new A_AddSingersFM(temp.songId, temp.songName, false,temp.albumCover,temp,-1, tb, logIn,logOut,1,0,0, Register));
                    Content.add(new A_Artisti(temp.artistId, temp.artistName, false,temp.artistPhoto,temp));
                    //  int m = temp.getSongId();
                    mas++;
                }
                tab3Manager.deleteAll();
                tab3Manager.add(Content);
            }
            catch(final Exception e)
            {
    
                e.printStackTrace();
                System.out.println("------------------- ");
            }
            return tab3Manager;
        }
        protected boolean touchEvent(TouchEvent touchEvent)
        {
            int eventCode = touchEvent.getEvent();
    
            if(eventCode == TouchEvent.GESTURE){
                System.out.println("SWIPE GESTURE");
                TouchGesture g = touchEvent.getGesture();
                int gesturecode = g.getEvent();
                int direction = g.getSwipeDirection();
    
                //gallery.setHorizontalScroll(page_two, true);
                if(direction == TouchGesture.SWIPE_WEST)
                {
    
                    if(tabNum == 3)
                    {
                        delete(tabArea);
                        tabArea = displayTab2();
                        add(tabArea);
                    }
                    else if(tabNum == 2)
                    {
                        delete(tabArea);
                        tabArea = displayTab3();
                        add(tabArea);
                    }
                }
    
                if(direction == TouchGesture.SWIPE_EAST)
                {
    
                    if(tabNum == 1)
                    {
                        try
                        {
                            delete(tabArea);
                        }
                        catch(Exception e)
                        {
                            try
                            {
                                tabArea = displayTab2();
                            }
                            catch(Exception ef)
                            {
                                add(tabArea);
                                return false;
                            }
                            add(tabArea);
                            return false;
                        }
                        try
                        {
                            tabArea = displayTab2();
                        }
                        catch(Exception ef)
                        {
                            add(tabArea);
                            return false;
                        }
                        add(tabArea);
                        return false;
    
                    }
                    else if(tabNum == 2)
                    {
                        try
                        {
                            delete(tabArea);
                        }
                        catch(Exception e)
                        {
                            try
                            {
                                tabArea = displayTab1();
                            }
                            catch(Exception ef)
                            {
                                add(tabArea);
                                return false;
                            }
                            add(tabArea);
                            return false;
                        }
                        try
                        {
                            tabArea = displayTab1();
                        }
                        catch(Exception ef)
                        {
                            add(tabArea);
                            return false;
                        }
                        add(tabArea);
                        return false;
                    }
                }
            }
            //The touch event was not consumed.
            return false;
        }
    }
    

    On the sidelines, East or West navigation events I illegalargument exception.and my page crashing.

    However, when I run the same code through the debugger it works fine. I put my debugging inside the touchevent ifs and elses togglepoints.

    And note, if it crashes and I click on an illegal argument exception... I go back to the home page and as if the touchevent function was called twice and 2 strips was skipped.

    It works fine but through debugger.any help?

    very strange, I did this and it worked

    protected boolean touchEvent(TouchEvent message)
        {
            try
            {
                int eventCode = message.getEvent();
    
                if(eventCode == TouchEvent.GESTURE){
                    System.out.println("SWIPE GESTURE");
                    TouchGesture g = message.getGesture();
                    int gesturecode = g.getEvent();
    
                    switch(gesturecode) {
    
                        case TouchGesture.SWIPE:
                            int direction = g.getSwipeDirection();
                        //gallery.setHorizontalScroll(page_two, true);
                        if(direction == TouchGesture.SWIPE_WEST)
                        {
    
                            if(tabNum == 3)
                            {
                            //  delete(tabArea);
                            //  tabArea = displayTab2();
                            //  add(tabArea);
                                tab2.setFocus();
                                return super.touchEvent(message);
                            }
                            else if(tabNum == 2)
                            {
                            //  delete(tabArea);
                            //  tabArea = displayTab3();
                            //  add(tabArea);
                                tab3.setFocus();
                                return super.touchEvent(message);
                            }
                        }
                        else if(direction == TouchGesture.SWIPE_EAST)
                        {
    
                            if(tabNum == 1)
                            {
    
                                        //delete(tabArea);
                                        //tabArea = displayTab2();
                                        //add(tabArea);
                                        tab2.setFocus();
                                        return super.touchEvent(message);
    
                            }
                            else if(tabNum == 2)
                            {
    
                                    //delete(tabArea);
                                    //tabArea = displayTab1();
                                    //add(tabArea);
                                    tab1.setFocus();
                                    return super.touchEvent(message);
    
                            } }
    
                        break;
                    }
                }
                    //The touch event was not consumed.
                    return super.touchEvent(message);
            }
            catch(Exception eol)
            {
                return super.touchEvent(message);
            }
        }
    

    I do this on tab2.setfocus (), if I call setfocus it works... but if icall it separately as it is not and it hangs. very strange

    // delete(tabArea);
                            //  tabArea = displayTab2();
                            //  add(tabArea);
    
    
    
  • Horizontal scrolling grid

    Hello world

    I have a grid, but the last two columns are displayed on the screen. Anyone know how I could enable horizontal scrolling.  I am a complete Newbie so apologies if my code is doubtful;

    Import net.rim.device.api.ui.container.GridFieldManager;
    Net.rim.device.api.ui import. *;
    Import net.rim.device.api.ui.component.LabelField;
    Import net.rim.device.api.ui.component.SeparatorField;
    Import net.rim.device.api.ui.component.ObjectChoiceField;

    Grid/public class extends UiApplication
    {
    Public Shared Sub main (String [] args)
    {
    Grid PAP = new Grid();
    theApp.enterEventDispatcher ();
    }

    Grid()
    {
    pushScreen (new GridScreen());
    }
    }

    class GridScreen extends TimetableMainScreen {}

    public GridScreen()
    {
    setTitle ("your week, created by the calendar");

    GridFieldManager grid = new GridFieldManager (10,6,1);

    grid.setHorizontalScroll (RIGHTMOST);

    Grid.Insert (new LabelField ("TimeTable"), 0, 0);
    Grid.Insert (new LabelField("9"), 1, 0);
    Grid.Insert (new LabelField("10"), 2, 0);
    Grid.Insert (new LabelField("11"), 3, 0);
    Grid.Insert (new LabelField("12"), 4, 0);
    Grid.Insert (new LabelField("13"), 5, 0);
    Grid.Insert (new LabelField("14"), 6, 0);
    Grid.Insert (new LabelField("15"), 0, 7);
    Grid.Insert (new LabelField("16"), 8, 0);
    Grid.Insert (new LabelField("17"), 9, 0);
    Grid.Insert (new LabelField ("Monday"), 0.1);
    Grid.Insert (new LabelField ("Tuesday"), 0, 2);
    Grid.Insert (new LabelField ("Wednesday"), 0, 3);
    Grid.Insert (new LabelField ("Thursday"), 0, 4);
    Grid.Insert (new LabelField ("Friday"), 0, 5);

    String choice [] = {'1', '2', '3', '4', '5', 'Free', 'Révision'};
    ObjectChoiceField objChoice = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice1 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice2 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice3 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice4 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice5 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice6 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice7 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice8 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice9 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice10 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice11 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice12 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice13 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice14 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice15 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice16 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice17 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice18 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice19 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice20 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice21 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice22 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice23 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice24 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice25 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice26 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice27 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice28 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice29 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice30 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice31 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice32 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice33 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice34 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice35 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice36 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice37 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice38 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice39 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice40 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice41 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice42 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice43 = new ObjectChoiceField("",choices);
    ObjectChoiceField objChoice44 = new ObjectChoiceField("",choices);

    Grid.Add (objChoice);
    Grid.Add (objChoice1);
    Grid.Add (objChoice2);
    Grid.Add (objChoice3);
    Grid.Add (objChoice4);
    Grid.Add (objChoice5);
    Grid.Add (objChoice6);
    Grid.Add (objChoice7);
    Grid.Add (objChoice8);
    Grid.Add (objChoice9);
    Grid.Add (objChoice10);
    Grid.Add (objChoice11);
    Grid.Add (objChoice12);
    Grid.Add (objChoice13);
    Grid.Add (objChoice14);
    Grid.Add (objChoice15);
    Grid.Add (objChoice16);
    Grid.Add (objChoice17);
    Grid.Add (objChoice18);
    Grid.Add (objChoice19);
    Grid.Add (objChoice20);
    Grid.Add (objChoice21);
    Grid.Add (objChoice22);
    Grid.Add (objChoice23);
    Grid.Add (objChoice24);
    Grid.Add (objChoice25);
    Grid.Add (objChoice26);
    Grid.Add (objChoice27);
    Grid.Add (objChoice28);
    Grid.Add (objChoice29);
    Grid.Add (objChoice30);
    Grid.Add (objChoice31);
    Grid.Add (objChoice32);
    Grid.Add (objChoice33);
    Grid.Add (objChoice34);
    Grid.Add (objChoice35);
    Grid.Add (objChoice36);
    Grid.Add (objChoice37);
    Grid.Add (objChoice38);
    Grid.Add (objChoice39);
    Grid.Add (objChoice40);
    Grid.Add (objChoice41);
    Grid.Add (objChoice42);
    Grid.Add (objChoice43);
    Grid.Add (objChoice44);

    grid.getBorder (1);
    grid.setBorder (HIGHLIGHT_SELECT, getBorder (1));

    grid.setColumnPadding (7);
    grid.setRowPadding (15);
    Add (new SeparatorField());

    Add (Grid);
    Add (new SeparatorField());

    }

    }

    See you soon!

    Hi small changes it works refer. Plese find my seals to a BOLD font

    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.component.ObjectChoiceField;
    import net.rim.device.api.ui.component.SeparatorField;
    import net.rim.device.api.ui.container.GridFieldManager;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    class GridScreen extends TimetableMainScreen{
    
        public GridScreen()
        {
        setTitle("Your Week, created by TimeTable");
    
        VerticalFieldManager vmagr=new VerticalFieldManager(HORIZONTAL_SCROLL|VERTICAL_SCROLL){ protected void sublayout(int maxWidth, int maxHeight) { super.sublayout(Display.getWidth(),Display.getHeight()); setExtent(Display.getWidth(),Display.getHeight()); } };
        GridFieldManager grid = new GridFieldManager(10,6,Manager.HORIZONTAL_SCROLL);
    
        grid.insert(new LabelField("TimeTable",Field.FOCUSABLE), 0, 0);
        grid.insert(new LabelField("9"), 1, 0);
        grid.insert(new LabelField("10"), 2, 0);
        grid.insert(new LabelField("11"), 3, 0);
        grid.insert(new LabelField("12"), 4, 0);
        grid.insert(new LabelField("13"), 5, 0);
        grid.insert(new LabelField("14"), 6, 0);
        grid.insert(new LabelField("15"), 7, 0);
        grid.insert(new LabelField("16"), 8, 0);
        grid.insert(new LabelField("17"), 9, 0);
        grid.insert(new LabelField("Monday",Field.FOCUSABLE|FIELD_RIGHT), 0,1);
        grid.insert(new LabelField("Tuesday",Field.FOCUSABLE|FIELD_RIGHT), 0, 2);
        grid.insert(new LabelField("Wednesday",Field.FOCUSABLE|FIELD_RIGHT), 0, 3);
        grid.insert(new LabelField("Thursday",Field.FOCUSABLE|FIELD_RIGHT), 0, 4);
        grid.insert(new LabelField("Friday          ",Field.FOCUSABLE|FIELD_RIGHT), 0, 5);
    
        String[] choices= {"1","2","3","4","5","Free","Revision"};
        ObjectChoiceField objChoice =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice1 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice2 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice3 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice4 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice5 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice6 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice7 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice8 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice9 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice10 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice11 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice12 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice13 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice14 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice15 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice16 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice17 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice18 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice19 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice20 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice21 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice22 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice23 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice24 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice25 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice26 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice27 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice28 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice29 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice30 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice31 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice32 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice33 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice34 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice35 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice36 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice37 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice38 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice39 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice40 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice41 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice42 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice43 =new ObjectChoiceField("",choices);
        ObjectChoiceField objChoice44 =new ObjectChoiceField("",choices);
    
        grid.add(objChoice);
        grid.add(objChoice1);
        grid.add(objChoice2);
        grid.add(objChoice3);
        grid.add(objChoice4);
        grid.add(objChoice5);
        grid.add(objChoice6);
        grid.add(objChoice7);
        grid.add(objChoice8);
        grid.add(objChoice9);
        grid.add(objChoice10);
        grid.add(objChoice11);
        grid.add(objChoice12);
        grid.add(objChoice13);
        grid.add(objChoice14);
        grid.add(objChoice15);
        grid.add(objChoice16);
        grid.add(objChoice17);
        grid.add(objChoice18);
        grid.add(objChoice19);
        grid.add(objChoice20);
        grid.add(objChoice21);
        grid.add(objChoice22);
        grid.add(objChoice23);
        grid.add(objChoice24);
        grid.add(objChoice25);
        grid.add(objChoice26);
        grid.add(objChoice27);
        grid.add(objChoice28);
        grid.add(objChoice29);
        grid.add(objChoice30);
        grid.add(objChoice31);
        grid.add(objChoice32);
        grid.add(objChoice33);
        grid.add(objChoice34);
        grid.add(objChoice35);
        grid.add(objChoice36);
        grid.add(objChoice37);
        grid.add(objChoice38);
        grid.add(objChoice39);
        grid.add(objChoice40);
        grid.add(objChoice41);
        grid.add(objChoice42);
        grid.add(objChoice43);
        grid.add(objChoice44);
    
        grid.getBorder(1);
        grid.setBorder(HIGHLIGHT_SELECT, getBorder(1));
    
        grid.setColumnPadding(7);
        grid.setRowPadding(15);
        add(new SeparatorField());
    
        vmagr.add(grid); vmagr.add(new SeparatorField()); add(vmagr);
    
        }
        public boolean onMenu(int instance) {
    
            return true;
        }
    
        }
    
  • Problem Manager of horizontal scrolling for OS 6.0 and more?

    Hi all. I have a problem with the Manager of Horizontal scrolling. Every thing worked for OS 5.0 and below, the question arises for OS 6.0 and more. For example, check the following:

    I have 2 HFM added to the optimization of resources.

    HFM1 - contains 2 buttons.

    HFM2 - contains 6 buttons, and the user can scroll between the buttons.

    The questions is when user keep hitting the right key, when the focus is on the second button of HFM1, then the content of HFM2 scrolls to the right - what is bad behavior.

    Check the screenshot for Simulator 9810 (when scrolling to the right inside the HFM which contains the test1, test2 scrolls the second HFM):

    Scrolling in a managing scrools in another, why this happen and how that might be solved?

    Thank you in advance.

    Finally, I found a solution using ScrollChangeListener (SCL).

    So what I did I set the SCL for HFM2, then:

     public void scrollChanged(final Manager manager, int newHorizontalScroll,
                int newVerticalScroll)
        {
    
            //----> fixing the issue when one HFM scroll another one for OS 6.0 and above
            int fwf = manager.getFieldWithFocusIndex();
            if (fwf == -1)
                manager.setHorizontalScroll(0);
            //<---- fixing the issue when one HFM scroll another one for OS 6.0 and above
    
    }
    

    Thanks to all in any case.

Maybe you are looking for

  • Talk to the text sent by 'null '.

    When I try and talk to the text of my husband, it continues to send "null" while Siri said she looks and she is sending.  It works with my two other friends who have iPhones.  Suggestions?  I already turned my phone market.

  • How can I get the message at the top instead of bottom?

    Use of mail coming on top but now new mail arrives at bottom. I want new messages coming ontop

  • Satellite L850-A696 (loss of pilot + no wireless connection)

    Hi youI have a laptop model Satellite L850-A696 serial No. 3C264274R Windows 7 I remove the driver programs by mistake after that I noticed that the wireless icon disappearNow I use the cable to connect to the internet.How can I fix this and restore

  • Is my iCloud Keychain backup my passwords correctly and surely?

    Hello. I went through the following thing: when I go in the Safari preferences and uncheck the AutoFill usernames and passwords in the password tab, I get fillings auto on the names of user/password despite the fact that I have my active bunch. Then

  • How old is my Skype account?

    Hello everyone, I created my account Skype loooong long time ago, and I realized that I forget even how old is my account heh Is it possible to check this? haha I remember when I created my Skype account was red heh (not blue)