Horizontal management; Animation of land

Hey,.

I'm not sure if I came across an error within the blackberry platform or not, but this is the situation. I have a CustomManager that contains 25 fields with a horizontal scrolling. Scrolling of the field is great and all the fields appear. However, the issue I stumbled on was the TouchEvent method contained in the fields themselves. Generally, my plan is to highlight a certain area in the case of development. Therefore, I check if the global coordinates were contained in my HFM and then checked to see if the field is in x and y location contained in the Manager. It works until the user scrolls the HFM. By debuggin my request, I noticed that the scope of the field never gets updated as long as the user scrolls the default position. To what extent is not the position of the field in the visible site?

Mitchell Romanuik.

Edit: the solution I stumbled on that is simple. Clear, that I don't understand how the touchEvent still work after reading the documentation because I changed the return false instead of true to produce the effect I wanted. Perhaps that there is false for the touchEvent in Manager can be pulled? Who knows. Problem solved, however.

In my code, I add getHorizontalScroll() to message.getX (1) and getVerticalScroll() to message.getY (1) in order to obtain the position of contact in the coordinates of the Manager.  Then you can check if the measurement of the field contains the position of the button.  His Manager scroll that he cannot update its scope - given that the field does not make up for this with your treatment touchEvent.

Oh and even if you treat things like TouchEvent.DOWN, do not call super.touchEvent after DOWN - this might be the beginning of a sudden or a move (or a CLICK or a TAP, or...).  That's why return false product for best results - framework fed BB the event to the rest of the affected areas.

Tags: BlackBerry Developers

Similar Questions

  • question on horizontal Manager

    Hello

    If I add much tag fields in a horizontal management, the fields in the label is not automatically does not come to the next line, if it is greater than the width of the screen, although I set the screen width of the horizontal manaer using the setlayout method. What is the problem, I could not understand. It is not possible?

    Please help me.

    FlowFieldManager does not have this?  I think that the point of HorizontalFieldManager is anything that scrolls sideways rather than flowing.

  • Addition of BitmapFields to Horizontal Manager

    Hi all

    I have a popupscreen (VerticalFieldmanager) I added an editfield, a LabelFieldby directly by calling (editfield or labelfield) and a Horizontal add field (horizontalField), calling for this horizontalField, I added four BitmapFields

    Problem:

    (1) I need padding or space between four bitmapFields

    (2) how to resize BitmapFields

    (3) how to draw a Rectangle when BitmapField is concentrated, where to write this method, what precauctions must be in subpaint (Graphics g)

    Help:

    If anyone has some tutorial or examples graphics or managers, please specify a link. Documentation is not clear in detail, when to use subLayout and subpaint

    I suggest you familiarize yourself with

    http://NA.BlackBerry.com/eng/developers/

    Note the resources option that brings you here:

    http://NA.BlackBerry.com/eng/developers/resources/

    From there, there are many places to search for information on other issues you may have, and this

    In particular, in this case, I suggest you look at the videos section, there you will find two very helpful videos on the screens and managers, which fills some basic information you need.

    In addition, all your questions are answered in various posts on this forum, I suggest do you good research tour and see what you find.

    Good luck.

  • How empy and replace the buttons inside the Manager of horizontal management.

    Hello! So basically, I have 2 buttons at the top of the screen and a set of buttons inside a HorizontalFieldManager (let's call is Set 1 and 2). Now, when I click on the first button it should appear a Set 1 and then appear Set 2 and remove the Set1 on screen. How can I do this? Thank you!

    -Ryan

    The details in the referenced thread, you should get going.

    Basically, you add and remove fields.

    I suggest that you have a Manager to Set 1 and a Manager for value 2.  Add the two managers to the screen, with nothing in it,

    Make sure that Manager 2 is empty (deleteAll) and add fields associated with the value 1 to the Manager for the value 1, when they should be displayed - i.e. trigger it by pressing button 1.

    Remove the fields in Manager 1 and add the fields associated with the value 2 to the Manager for Set 2, when they should be displayed - i.e. trigger this by pressing button 2.

    I hope this helps.

  • style of Manager for the field Horizont

    Hello

    A simple but stubborn problem. I want to have a horizontal Manager with both Field.Use_All_Width and Field.Field_HCenter style bits.  I create the Manager in the medium folowing:

    HorizontalFieldManager hfm = new HorizontalFieldManager(Field.FIELD_HCENTER |Field.USE_ALL_WIDTH))
    

    but only styles is considered, depending on whether one is first. The clues why?

    If you set the USE_ALL_WIDTH style bit, the FIELD_HCENTER style is meaningless - how can center you a field that uses the entire width? Maybe you want to center the fields that are added to hfm. If so, this is not the way to do it.

    The style on a field bits are (usually) used by the container Manager to decide how to develop the land. That doesn't change when the field is to be a manager himself. To change the logic of the layout, you must set the style bits of the fields that are added to the Manager.

    Two other points. First of all, HorizontalFieldManager is sensitive to the vertical alignment styles but does not take account of horizontal alignment styles the fields he manages (the converse is true of VerticalFieldManagers). Second, it does not matter what order list you the styles.

    Field.FIELD_HCENTER | Field.USE_ALL_WIDTH == Field.USE_ALL_WIDTH | Field.FIELD_HCENTER

  • 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.

  • How to place fields on a manager horizontal?

    Hello

    I want to place two fields on the same horizontal Manager on both ends. IE I want to place a label on the left-hand side field and a ButtonField on the corner of the side right of the same manager Hhorizontal. I tried the following code, but did not work.

    For example:

    VFM VerticalFieldManager = new VerticalFieldManager();
    HFM HorizontalFieldManager = new HorizontalFieldManager();
    LabelField lblField = new LabelField ("test1", LabelField.FIELD_LEFT);
    ButtonField btnField = new ButtonField ("test2", ButtonField.FIELD_RIGHT);
            
    HFM. Add (lblField);
    HFM. Add (btnField);
    VFM. Add (HFM);

    This has not produced the expected results but on the contrary the two fields are aligned on the left side.

    I'm doing something wrong in the code above? Is there any alternative for this? Waiting for a response as soon as possible...

    Thank you

    Thank you guys for the quick response. The following code does the trick

    VFM VerticalFieldManager = new VerticalFieldManager();
    HFM HorizontalFieldManager = new HorizontalFieldManager();
           
    LabelField lblField = new LabelField ("test1", LabelField.FIELD_LEFT);
    ButtonField btnField = new ButtonField ("test2", ButtonField.FIELD_RIGHT);
           
    VerticalFieldManager vfmLeft = new VerticalFieldManager();
    VerticalFieldManager vfmRight = new VerticalFieldManager (Manager.USE_ALL_WIDTH);
           
    vfmLeft.add (lblField);
    vfmRight.add (btnField);
           
    HFM. Add (vfmLeft);
    HFM. Add (vfmRight);
    VFM. Add (HFM);

  • editable text field and button is not editable when added to the Manager of the Horizontal

    I find layout, when I added the button and EditField horizontally, Manager, I'm not able to write something in the EditField and not able to click on the button

    public class MyStorySearch extends MainScreen
    {
    
        private VerticalFieldManager mainManager;
        private VerticalFieldManager subManager;
        private Bitmap _backgroundBitmap = Bitmap.getBitmapResource("a.png");
        private int deviceWidth = Display.getWidth();
        private int deviceHeight = Display.getHeight();
        LabelField lbl;
        ButtonField gobtn= new ButtonField("Go");
        HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.FOCUSABLE|Manager.EDITABLE);
        private Field editfild;
        Bitmap bitmapImage = Bitmap.getBitmapResource("storysearch.png");
        BitmapField fieldDemo;
    
        public MyStorySearch()
        {
            super(NO_VERTICAL_SCROLL);
            //this manager is used for the static background image
            mainManager = new VerticalFieldManager(
                              Manager.NO_VERTICAL_SCROLL |
                              Manager.NO_VERTICAL_SCROLLBAR )
            {
                public void paint(Graphics graphics)
                {
                    graphics.clear();
                    graphics.drawBitmap(0, 0, deviceWidth,
                             deviceHeight, _backgroundBitmap, 0, 0);
                    super.paint(graphics);
                }
            };
    
            //this manger is used for adding the componentes
            subManager = new VerticalFieldManager(
                             Manager.VERTICAL_SCROLL |
                             Manager.VERTICAL_SCROLLBAR )
            {
                protected void sublayout(int maxWidth, int maxHeight)
                {
                    int displayWidth = deviceWidth;
                    int displayHeight = deviceHeight;
    
                    super.sublayout( displayWidth, displayHeight);
                    setExtent( displayWidth, displayHeight);
                }
            };
    
            //add your component to this subManager
            lbl = new LabelField("SUNRAYS SEARCH", LabelField.USE_ALL_WIDTH | DrawStyle.HCENTER);
            Font myFont = Font.getDefault().derive(Font.PLAIN, 10, Ui.UNITS_pt);
            lbl.setFont(myFont);
            subManager.add(lbl);
            subManager.add(new SeparatorField());
    
            editfild = new EditField(){
                protected void layout(int width, int height) {
                    setExtent(width*85/100, 30);
    
                };
            };
            editfild.setBorder( BorderFactory.createSimpleBorder( new XYEdges(2, 2, 2, 2),
                    new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
            editfild.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
    
            hfm.add(editfild);
            hfm.add(gobtn);
    
            subManager.add(hfm);
    
            //add subManager over the mainManager
            mainManager.add(subManager);
    
            //finally add the mainManager over the screen
            this.add(mainManager);
        }
    }
    

    The following code shows an EditField and a button, and I can type in the EditField and click the button.  It is not perfect, but at least it works.

    I don't know what the problem is with your code.  I suggest review you my code, review your code and investigate things that are different.

    Two areas I would focus on your layout and the sublayout.  As stated in a previous post, if you must code a setExtent in a layout, then you should really think about creating your own Manager - I gave you links to do this several times.  And if you plan to use a standard field and to make it work properly, you must use the sublayout.  Here is a link to help you create custom fields:

    http://supportforums.BlackBerry.com/T5/Java-development/create-custom-fields/Ta-p/444962

    Edit:

    Thanks for the update of these discussions.

    And I'm sorry.   I forgot to paste the code...  Here, it is now...

            EditField editfild = new EditField(){
                protected void layout(int width, int height) {
                    super.layout(width*85/100, height);
                };
            };
            editfild.setBorder( BorderFactory.createSimpleBorder( new XYEdges(2, 2, 2, 2),
                    new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
            editfild.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
            ButtonField gobtn= new ButtonField("Go") {
                protected boolean navigationClick(int status, int time){
                    Status.show("button clicked");
                    return true;
                }
            };
            HorizontalFieldManager hfm = new HorizontalFieldManager();
            hfm.add(editfild);
            hfm.add(gobtn);
            this.add(hfm);
    
  • Horizontal area manager

    Hello

    I have a HorizontalFieldmanager that contains two buttons fields... I added these two buttons for that HorizontalFieldmanager... I want the buttons should be the central position of the screen... but they are coming up on the left side of the screen... I used like this

    HorizontalFieldManager hfm=new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH|HorizontalFieldManager.FIELD_HCENTER);
    
    ButtonField submit=new ButtonField("Submit",ButtonField.FIELD_HCENTER|ButtonField.HCENTER);
    
    ButtonField cancel=new ButtonField("Cancel",ButtonField.FIELD_HCENTER|ButtonField.HCENTER);
    

    HorizontalFieldManager does not respect the horizontal alignments because it has its own approach to horizontal placement.  VerticalFieldManager respect that, though.  The simplest approach would be to:

    • Create two button controls - without the alignment style bits (I give them usually CONSUME_CLICK and NEVER_DIRTY but it's different)
    • Create a horizontal field Manager - with FIELD_HCENTER as one of the style bits
    • Add these two buttons in the horizontal field manager
    • create a handler of vertical field with USE_ALL_WIDTH as one of the style bits
    • Add horizontal management Manager to the vertical field manager

    This way your horizontal field Manager will place the buttons next to each other while the vertical field Manager notice the flag FIELD_HCENTER on the HFM and Center the gadget all the width of the screen (it's why we USE_ALL_WIDTH here)

  • Storm: is it possible to resize the horizontal width of the Manager?

    Hi all

    Is it possible to resize the horizontal width of the Manager. I want to create two buttons in horizontal management, set the border background. I use the following code to do this. It works very well. But as there are only two buttons and does not occupy the whole of the 320 width screen, frame border is happening only for these two buttons background. So I could see the spaces apart from the horizontal width in front and in rear areas. So I want to create a horizontal Manager himself with a width of 320, so that the layout border color indicates the full width. Is it possible to resize the horizontal width of the Manager?
     
    XYEdges borderColor = new XYEdges (Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK);
    NoPadding XYEdges = new XYEdges (2, 2, 2, 2);

    HorizontalFieldManager hzBtnFldManager = new HorizontalFieldManager (HorizontalFieldManager.FIELD_HCENTER);

    new CustomControl = createButton ("Create", ButtonField.FOCUSABLE |) ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER, 83, 15);
    cancelButton = new CustomControl ("Cancel", ButtonField.FOCUSABLE |) ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER, 83, 15);

    hzBtnFldManager.add (createButton);
    hzBtnFldManager.add (cancelButton);

    At the border btnBarPaddingBorder = BorderFactory.createSimpleBorder (noPadding, borderColor, Border.STYLE_SOLID);
    hzBtnFldManager.setBorder (btnBarPaddingBorder);
    hzBtnFldManager.setBackground (BackgroundFactory.createSolidBackground (Color.GRAY));

    this.setStatus (hzBtnFldManager);

    Resolved using HorizontalFieldManager (Field.USE_ALL_WIDTH);

  • Issue of bottom paint for horizontal scrolling

    Hello

    I have a HorizontalFieldManager with a gradient background which I've updated to enable horizontal scrolling. Scrolling works well, but the gradient background is not painted when scrolling to the right. Using trial and error "getHorizontalScroll()" to calculate and offset has not yet failed.

    The original code is lower for horizontal management.

    ...
        hm = new HorizontalFieldManager(hmStyle) {
          protected void paint (Graphics g) {
            g.clear();
            g.setBackgroundColor(bgColor);
            int[] xInds = new int[]{0, 0,getExtent().width, getExtent().width};
            int[] yInds = new int[]{0, getExtent().height, getExtent().height,0};
    
            final int[] cols = new int[]{bgColor, gradientColor, gradientColor, bgColor};
    
            g.drawShadedFilledPath(xInds, yInds, null, cols, null);
            super.paint(g);
          }
          protected void onFocus(int arg0) {
            super.onFocus(arg0);
            getScreen().invalidate();
          }
        };
    ...
    

    I know I'm probably not set up the xInds properly to compensate for offset from horizontal scrolling, but it's not obvious to me how to set up the offsets correctly. Can anyone offer a suggestion to troubleshoot? If not, is there a reference to certain documents which provides more detail than the docs of java on the functioning of the 'drawShadedFilledPath' and the logic of ScrollBar?

    Thanks in advance!

    int xstart = getHorizontalScroll();
    int xend = xstart + getVisibleWidth() - 1; // getWidth() is also good
    int[] xInds = new int[]{xstart, xstart, xend, xend};
    
  • How to add 2 Manager at the same time

    Hi all I would like to add to the vertical on the screen

    as

    1 VerticalManager to its vertical sides manager 2 as it comes in the form of 2 columns please help me how can I do...

    who is adding to the verical 1 verticalmanager 2 adjecent Manager

    Please help I'm trying to add VerticalManger2 but his view under the VerticalManager1 (that ONE AFTER THE OTHER MANAGERS ARE GETTING ADDED, BUT I DNT WANT AS what I WANT AS MANAGER TO BE ADJECENT to EACT OTHER)

    Concerning

    Adkins

    put these vertical frames in a horizontal Manager

  • Once again: the Horizontal alignment in HFM

    Hello

    I want to align a field of custom in a Horizontal Manager button

    Definition of the HFM

    final HorizontalFieldManager _navigation = new HorizontalFieldManager(HorizontalFieldManager.NO_VERTICAL_SCROLL | HorizontalFieldManager.FIELD_VCENTER | Field.USE_ALL_WIDTH)
    {
         protected void paint(Graphics graphics)
         {
             graphics.setGlobalAlpha(100);
    
             int[] xInds = new int[]{0, getExtent().width, getExtent().width, 0};
             int[] yInds = new int[]{0, 0, getExtent().height, getExtent().height};
             final int[] cols = new int[]{Color.WHITE, Color.WHITE, color_computacenter_light_blue, color_computacenter_light_blue};
    
             graphics.drawShadedFilledPath(xInds, yInds, null, cols, null);
             super.paint(graphics);
         }
         protected void sublayout(int maxWidth, int maxHeight)
            {
                super.sublayout(maxWidth, maxHeight);
                setExtent(maxWidth, navigation_vertical_manager_height);
            }
    };
    

    Custom field (partial)

    public class NavigationButton extends Field
    {
            private String label;
            Bitmap img;
            int horizontalPadding = 4;
            int verticalPadding = 10;
            static int height;
            static int weight;
            ToolTip _tooltip;
    
            public NavigationButton(String name, Bitmap img)
            {
                label = name;
                this.img = img;
                this.height = img.getHeight() + 4;
                this.weight = img.getWidth()  + 2;
            }
    
            public NavigationButton(String name, Bitmap img, long style)
            {
                super(style);
                label = name;
                this.img = img;
                this.height = img.getHeight() + 4;
                this.weight = img.getWidth()  + 2;
            }
    
            protected void layout(int maxWidth, int maxHeight)
            {
                setExtent(maxWidth, maxHeight);
                // setExtent(Math.min(weight, maxWidth), Math.min(height, maxHeight));
            }
    

    [...]

    Any ideas what I am doing wrong?

    Thank you!

    Thank you! The grid layout manager works very well, as you can see in my new assignment * g

  • How create the layout as in pic

    Hi, look in the upper part of the picture, how do I create the upper part of the photo, I have three components
    first is the registered image tag which must be at the Center and another image as in the screenshot
    should I placed in horizontal management, the most important is I want to put the text in a label in the center of the screen like in the pic.
    I put my first image and label filed and my third picture in landscape Manager, but the label does not appear in the center of the screen, please guide me...

    I recommend that this avinash_kumar_ispg_in test things before offering them.  The following styles actually work against each other:

    LabelField.USE_ALL_WIDTH - said how wide you are given, use it for the field, this will make the LabelField as wide as the space is available for this.

    LabelField.HCENTER said to organize the LabelField in the center of the space that is available to her.  Now if you also have USE_ALL_WIDTH specified, then the LabelField already uses all the space available, so there is nothing in the Center.

    In this case, what you really wanted was:

    LabelField.USE_ALL_WIDTH - which means as above

    DrawStyle.HCENTER - which means to paint the text to the center of the available space for it.

    But it will not work without a Manager customized for you.

    Have fun creating your own Manager to do this.

    Edit:

    I just saw your message about dominant layout().  Do not do this, create your own Manager.  Try something else is wasting your time.

  • Fields of HFM

    How can I obtain a field added in hfm and modify this field? I have a screen with a vertical area manager to mutilate. On the optimization of resources, I would add another vfm dynamically. This optimization of resources has a labelfield and horizontal management. This hfm has a bitmapfield and a labelfield. I was to get the bitmapfield and change the image and redraw again.

    Optimization of main resources

    VFM1

    LABELFIELD1

    HFM1

    VFM2

    LABELFIELD2

    HFM3

    I've found the workaround. I could get the bitmapfield using getfield (int index) call. Then replace the bitmap with a new image.

Maybe you are looking for