GridFieldManager

Hello friends

Well, my doubt is that I try to manage a grid of the domain manager and add a field, that the problem is that my gridfieldmanager I create

mesaManager = new GridFieldManager (2, 5, Field.FIELD_HCENTER) {}
protected void sublayout (int width, int height) {}
Width = 300;
height = 140;
setExtent (width, height);
Super.sublayout (width, height);

}
};

and when I try to mesaManager.add I can not give a hint of error bound, how I can add items (fields) to my gridfieldmanager?

Sorry my bad English

Please, I'm waiting for your help

It make much sense to use a special layout manager and crush its layout.

Visit this link on the custom layout managers:

http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800508/...

If you want to use a GridFieldManager use it without replacing the page layout.

Tags: BlackBerry Developers

Similar Questions

  • The value of width in gridfieldmanager?

    How can put the width in GridFieldManager?

    GridFieldManager gfm = new GridFieldManager (7,2,Field.FOCUSABLE| public FIELD_HCENTER);

    to set the column of the 1st column property...

    gfm.setColumnProperty (0, GridFieldManager.PREFERRED_SIZE_WITH_MAXIMUM, Display.getWidth () / 3);

    with above the width of the 1st property column will be 1/3 of the display screen

    gfm.setColumnProperty (1, GridFieldManager.PREFERRED_SIZE_WITH_MAXIMUM, 2 * Display.getWidth () / 3);

    with above the property width of the 2nd column will be 2/3 of the display screen

  • GridFieldManager question

    Hello

    is it possible to add pictures with LabelField using GridFieldManager Horizontal. If someone knows how to do it, please send me the link or sample example.

    Like this...

    1st rank---> image1 Image2 icon icon

    LabelField LabelField

    Row2---> Image3, Image4 icon icon

    LabelField LabelField

    Thank you

    Like this you can do:

    public class LoadingScreen extends MainScreen
    {
        VerticalFieldManager ver;
        ButtonField submit;
        HorizontalFieldManager hr;
    
        public LoadingScreen()
        {
            createGUI();
        }
        public void createGUI()
        {
            ver=new VerticalFieldManager(Manager.HORIZONTAL_SCROLL|Manager.HORIZONTAL_SCROLLBAR);
            GridFieldManager grid=new GridFieldManager(4, 2, Manager.HORIZONTAL_SCROLL);
            grid.add(new BitmapField(Bitmap.getBitmapResource("btn_add-2.png")));
            grid.add(new BitmapField(Bitmap.getBitmapResource("btn_add-2.png")));
            grid.add(new LabelField("ImageOne",Field.FOCUSABLE));
            grid.add(new LabelField("ImageTwo",Field.FOCUSABLE));
            grid.add(new BitmapField(Bitmap.getBitmapResource("btn_add-2.png")));
            grid.add(new BitmapField(Bitmap.getBitmapResource("btn_add-2.png")));
            grid.add(new LabelField("ImageThree",Field.FOCUSABLE));
            grid.add(new LabelField("ImageFour",Field.FOCUSABLE));
            grid.setColumnPadding(10);
            grid.setRowPadding(10);
            ver.add(grid);
            add(ver);
        }
    }
    

    ================================================================================

    Do not hesitate to click right THUMB (like) symbol if the answser is correct for you.

  • GridFieldManager problem they zoom automatically when return

    Hi all

    I have attached a sample application which I extract below the problem.

    GridFieldManager page zoom automatically when come back to another page or dialog box.

    Scenario according to the directives of the sample application: -.

    (1) launch of the application

    2) click the button 1 or 7

    3) click on the text field of the Find dialog box
    (4) close the "back" button keyboard
    (5) do same process 2 or 3 times after that you realize page zoom automatically (I have attached the screenshot).

    Note - this problem in touch device (9500,9550,9800) extraction.

    Hello

    Thanks for the reply.

    Yes, I know GridFieldManager.AUTO_SIZE work very well. But I can't zoom in GridFieldManager.FIXED_SIZE problem.

  • How to align the areas that fall within GridFieldManager

    Hello

    I have a GridFieldManager and I want to align the first three fields on the left and the last to the right. I tried to use ad FIELD_LEFT FIELD_RIGHT, but this does not seem to do the trick. Any ideas?

    My code:

    GridFieldManager grid = new GridFieldManager(3, 4, USE_ALL_WIDTH | NON_FOCUSABLE);
            for (int i = 0; i < data.length; i++) {
                LabelField label = new LabelField(data[i].getS1(), FIELD_LEFT | NON_FOCUSABLE);
                LabelField value = new LabelField(data[i].getS2(), FIELD_LEFT | NON_FOCUSABLE);
                LabelField unit = new LabelField(data[i].getS3(), FIELD_LEFT | NON_FOCUSABLE);
                BitmapField pic = new BitmapField(b, FIELD_RIGHT | NON_FOCUSABLE);
                grid.insert(label, i, 0);
                grid.insert(value, i, 1);
                grid.insert(unit, i, 2);
                grid.insert(pic, i, 3);
            }
            add(grid);
    

    Hello

    Try using Insert with a style:

    grid.insert(label, i, 0, FIELD_LEFT);
    

    Here is the link:

    http://www.BlackBerry.com/developers/docs/5.0.0api/NET/rim/device/API/UI/container/GridFieldManager...

    E.

  • rotation on GridFieldManager problem

    Hello world

    I'm having a hard time trying to manage the rotation for GridFieldManager.

    I put the properties of column as GridFieldManager.FIXED_SIZE. I add the data to the grid. Then I add the grid to an absolute layout manager. And in the case of rotation, change the properties of the column in the sublayout of the absolute layout manager. Nothing changes.

    Could you please suggest a better approach to this problem?

    Kind regards

    I do not see GridFieldManager code in there, I assume that it is this code that is changing things.

    There is a round floating GridFieldManager that initially seemed to come from the code provided by Anthony Rizk in his book "Beginning BlackBerry Development".  I looked at this code, but to do this kind of layout, I prefer TableLayoutManager, which is a bit of code provided to the RIM.  You will find it here:

    http://supportforums.BlackBerry.com/T5/Java-development/create-a-rich-UI-layout-with-TableLayoutMana...

  • Focus with GridFieldManager problem

    I'm having a problem of development/unfocus.  A label should draw a border of red around him when it gets the focus and a black border when he loses it.  But when I add/remove a label for a GridFieldManager (see below the code and the screenshot), I find that the update will temporarily to the field at (0,0) and 'loses' never the focus - in other words, he draws a red border, but never black.  So, I end up having 2 fields with the red border - something that should never happen!

    I'm under 5.0 SDK on Eclipse.  I reproduced the problem in the simplest possible form: If you import the following code, you'll see for yourself.  Please help me!

    Import net.rim.device.api.ui.XYEdges;
    Import net.rim.device.api.ui.component.LabelField;
    Import net.rim.device.api.ui.container.GridFieldManager;
    Import net.rim.device.api.ui.container.MainScreen;
    Import net.rim.device.api.ui.decor.Border;
    Import net.rim.device.api.ui.decor.BorderFactory;

    / public final class screen extends MyScreen
    {
    private GridFieldManager MDT;
       
    public MyScreen()
    {
    Set the displayed title of the screen
    setTitle ("MyTitle");
    int size = 3;
    GFM = new GridFieldManager (size, size, GridFieldManager.FIELD_HCENTER |) GridFieldManager.FOCUSABLE);
    for (int y = 0; y)< size;="" y++)="">
    for (int x = 0; x)< size;="" x++)="">
    LabelField nf = new LabelField ("H", LabelField.FOCUSABLE) {}
    protected boolean navigationClick (int time, int status) {}
    swap (this);
    this.setFocus ();
    Returns true;
    }

    Protected Sub onFocus (int direction) {}
    this.setBorder (BorderFactory.createSimpleBorder (new XYEdges (1,1,1,1), new XYEdges(0xFF0000,0xFF0000,0xFF0000,0xFF0000), Border.STYLE_DASHED));
    }
                       
    protected void onUnfocus () {}
    this.setBorder (BorderFactory.createSimpleBorder (XYEdges (1,1,1,1))) of new;
    }

    };
    nf.setBorder (BorderFactory.createSimpleBorder (XYEdges (1,1,1,1))) of new;
                   
    GFM. Add (NF);
    }
    }
    Add (GFM);
    }
       
    private void swap (LabelField lf) {}
    GFM. Delete (LF);
    GFM. Add (LF);
    }
    }

    Thus, even if I clicked on the intermediate element, an area of development is established around the item to (0,0)

    Why is this?

    Sorry to get to this post, this late - I could have saved a lot of traffic if I noticed it earlier...

    In any case - onUnfocus has a very strange behavior. In some cases (I don't know which) it is not called at all when the field loses focus. So, rather than using onFocus/onUnfocus pair, use FocusChangeListener. This listener will turn on the eventType and onFocus on FOCUS_GAINED work and the work of onUnfocus on FOCUS_LOST.

    Overall, it will look like this:

    import net.rim.device.api.ui.XYEdges;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.GridFieldManager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.decor.Border;
    import net.rim.device.api.ui.decor.BorderFactory;
    
    public final class MyScreen extends MainScreen
    {
        private GridFieldManager gfm;
    
        public MyScreen()
        {
            // Set the displayed title of the screen
            setTitle("MyTitle");
            int size = 3;
            FocusChangeListener fcl = new FocusChangeListener() {
              public void focusChanged(Field field, int eventType) {
                switch (eventType) {
                case FOCUS_GAINED:
                  field.setBorder(BorderFactory.createSimpleBorder(new XYEdges(1,1,1,1), new XYEdges(0xFF0000,0xFF0000,0xFF0000,0xFF0000), Border.STYLE_DASHED), false);
                  break;
                case FOCUS_LOST:
                  field.setBorder(BorderFactory.createSimpleBorder(new XYEdges(1,1,1,1)), false);
                  break;
                case FOCUS_CHANGED:
                  break;
                default:
                  break;
                }
              }
            };
            gfm = new GridFieldManager(size,size,GridFieldManager.FIELD_HCENTER|GridFieldManager.FOCUSABLE);
            for (int y = 0; y < size; y++) {
                for (int x = 0; x < size; x++) {
                    LabelField nf = new LabelField("H", LabelField.FOCUSABLE) {
                        protected boolean navigationClick(int time, int status) {
                            swap(this) ;
                            this.setFocus();
                            return true;
                        }
    
                    };
                    nf.setBorder(BorderFactory.createSimpleBorder(new XYEdges(1,1,1,1)));
                    nf.setFocusListener(fcl);
    
                    gfm.add(nf);
                }
            }
            add(gfm);
        }
    
        private void swap(LabelField lf){
            gfm.delete(lf);
            gfm.add(lf);
        }
    }
    

    You will notice that I have created a FocusChangeListener to listen each LabelField and changed calls setBorder on focus has changed not update in page layout (as does not change the size of the border), which will make it much more effective and does not cause the entire screen redraw

    You can do even better if you setBorder on the ground as it is created, but use the long form - viewable one following first parameter. Define borders forVISUAL_STATE_FOCU andVISUAL_STATE_NORMA at least. Again, take a long look at prototypes withupdateLayou indicator. This way you won't have to worry about changes in development at all - the system will do it for you

  • GridFieldManager with label get wider

    I searched the forums, but can't find the answer to my problem. so, who can help me here.

    I have a GridFieldManager, with 2 containing static text and two labels with the text I want to change during execution.

    GridFieldManager gfm = new GridFieldManager(2, 2, Manager.USE_ALL_WIDTH | GridFieldManager.FIXED_SIZE);
    gfm.setColumnProperty(0, GridFieldManager.FIXED_SIZE, 300);
    gfm.setColumnProperty(1, GridFieldManager.FIXED_SIZE, 180);
    float TMeasured = 180 / 10;
    float TSetpoint = 195 / 10;
    lTemperatureMeasured = new LabelField(Float.toString(TMeasured) + "°c");
    lTemperatureSetpoint = new LabelField(Float.toString(TSetpoint) + "°c");
    gfm.add(new LabelField("Temperature measured"), FIELD_LEFT);
    gfm.add(lTemperatureMeasured, FIELD_LEFT);//RIGHT);
    gfm.add(new LabelField("Temperature setting"), FIELD_LEFT);
    gfm.add(lTemperatureSetpoint, FIELD_LEFT);//RIGHT);
    add(gfm);
    

    the problem is that when I change the text of the label, the GridFieldManager becomes wider! simply, it grows and grows by something like 5 pixels. change the fixed width did not help.

    I just can't understand why this happens. who does that?

    Text editing is done with a button:

    public void fieldChanged(Field field, int context)
    {
        if(field == bChangeTemperature)
        {
             lTemperatureSetpoint.setText("t");
        }
    }
    

  • Focus BitmapField occuping all GridFieldManager cell...

    Hello

    I have the following problem, I have a Focus bitmapfield 30 x 30 which I add to a 100 x 100 GridFieldManager cell.

    The problem is when I click in the cell, but out of the picture, the complete cell concentrates and the navigationClick is still running... How can adjust the focus to the image and not the cell area?

    My code is very simple

    BitmapField refreshImg = new BitmapField(Bitmap.getBitmapResource(RutasUtils.REFRESH_IMAGE),BitmapField.FOCUSABLE);
    grid.add(refreshImg);
    

    OK, thanks anyway.

    I found a 'solution '.

    I use setPadding, because I am by aligning the button refresh to the upper right. Instead of using zero for the bottom and left padding, I increased the value to convert the entire region of the 'empty' cell padding and to avoid the previous behavior:

    refreshImg.setPadding (5, 10, 55, 10);

  • FieldChangeListener for a GridFieldManager element

    Hello

    I have a GridFieldManager loaded with lots of elements in the horizontalFieldManagers type. I noticed after you add managers to GridFieldManager and appellant getFieldAtIndex to my GridFieldManager, she will return me a FIELD. Can I put a FieldChangeListener to the returned field? What I know is that I couldn't do it at HorizontalFieldManager. But I can do this returned field?

    My intention is to create a list, whenever you click on one of the elements, it will change the content of the gridfieldmanager.

    Thank you very much!

    Yes, but BitmapFields does not normally change so don't do not normally call the change listener.  You need to implement yourself for the field.  It's easy, substitute navigationClick and touchEvent.  There are many examples on this forum looking for an Image button.

  • gridfieldmanager custom

    Dear all,

    I tried to implement a GridFieldManager by copying one of the displayed example. I realize that there is a such GridFieldManager documented in API 5.0. However, I may need to cater for older devices, i.e. running 4.5. The problem is after I added in BitmapFields in this GridFieldManager and I try to navigate around, the first field is always focused. He never sail anywhere. Here are the updated navigationMovement

    protected boolean navigationMovement (int dx, int dy, int, int time status) {}
            
    int focusIndex = getFieldWithFocusIndex();
            
    While (dy > 0) {}
    focusIndex += columns;
    {If (focusIndex > = {getFieldCount())}
    Returns false; The focus moves on this manager
    }
    else {}
    Field f = getField (focusIndex);
    If (f.isFocusable ()) {/ / only move the focus on the fields of the object of focus}
    If (f instanceof ImageButtonField)
    {
    IBF ImageButtonField = f (ImageButtonField);
    If (IBF.isOnFocus ())
    {
    f.setFocus ();
    -DY;
    }
    }
    on the other
    {
    f.setFocus ();
    -DY;
    }
    }
    }
    }
            
    While (dy< 0)="">
    focusIndex = columns;
    If (focusIndex< 0)="">
    Returns false;
    }
    else {}
    Field f = getField (focusIndex);
    If (f.isFocusable ()) {}
    If (f instanceof ImageButtonField)
    {
    IBF ImageButtonField = f (ImageButtonField);
    If (IBF.isOnFocus ())
    {
    f.setFocus ();
    DY ++;
    }
    }
    on the other
    {
    f.setFocus ();
    DY ++;
    }
    }
    }
    }
            
    While (dx > 0) {}
    focusIndex ++;
    {If (focusIndex > = {getFieldCount())}
    Returns false;
    }
    else {}
    Field f = getField (focusIndex);
    If (f.isFocusable ()) {}
    If (f instanceof ImageButtonField)
    {
    IBF ImageButtonField = f (ImageButtonField);
    If (IBF.isOnFocus ())
    {
    f.setFocus ();
    -DX;
    }
    }
    on the other
    {
    f.setFocus ();
    -DX;
    }
    }
                    
    }
    }
            
    While (dx< 0)="">
    -focusIndex;
    If (focusIndex< 0)="">
    Returns false;
    }
    else {}
    Field f = getField (focusIndex);
    If (f.isFocusable ())
    {
    If (f instanceof ImageButtonField)
    {
    IBF ImageButtonField = f (ImageButtonField);
    If (IBF.isOnFocus ())
    {
    f.setFocus ();
    DX ++;
    }
    }
    on the other
    {
    f.setFocus ();
    DX ++;
    }
    }
    }
    }
            
    Returns true;
    }

    I wonder if there is a problem with it. Help, please. Thank you...

    Hi guys,.

    apparently moveFocus (focusIndex, status, time); the round is played. I have inserted after f.setFocus.

  • Strange: Objectchoicefield and ObjectListField in Gridfieldmanager - navigation problem

    Hi @all,

    I have a very strange problem, because running Simulator runs as I would have liked, but the device, the navigation is bad:

    running OS 5.0.0.42 3 on device (BB9700) and the Simulator

    1. the building screen

    2. put verticalfieldmanager on it that contains the background image

    3. put gridscreenmanager (with a column - the problem is with more then one column, too) on the first position of the vfm

    4. turn objectchoicefield with 5 points on the 1st row of the gsm

    5. put the objectlistfield with 5 points on the second line of gsm

    Program running in the Simulator:

    View all as I prefer.

    The first objectchoicefield and beyond the objectlistfield.

    When I scroll with trackpad OCF Gets the focus first and after that the olf on its first line.

    I can scroll up and down, and everything's fine.

    Program running on the device:

    View all as I prefer.

    The first objectchoicefield and beyond the objectlistfield.

    When I scroll with trackpad OCF Gets the focus first and after that the olf on its first line.

    So far so good:

    When I scroll down to the olf, all things are working properly. For example, point 4 a now focus.

    Now, if I try to go back in the OLF, it should go back to article 3 of the olf, but this is the leap into objectchoicefield. After that, if I try to go back to the objectlistfield, it jumps directly to point 4, which he came before.

    If I don't put the objectchoicefield in the first row, everything works fine.

    What can I do?

    I did something wrong?

    All ideas are very appeciated.

    Thanks in advance.

    CUA

    Michael

    Well, I found it.

    I made a mistake in the application of my own gridfieldmanager navigationmovement method.

    What is already strange: I used the same gridfieldmanager within 2 screens in my application. First screen was working fine, the second one was bad. Same content in both screens.

    Sorry for that.

    Thank you for all.

    CUA

    Michael

  • Move the icons in GridFieldManager

    Hello

    Trying to develop an application that contains the icons arranged in a grid using GridFieldManager.

    Currently positions of the icons are fixed once they are added to the grid.

    Is there a way to do such as users are able to rearrange the position of the icons in the grid? for example, move to a different empty location in the grid.

    A good example would be like the menu BB where we can highlight the icon, select 'Move' and choose the new location.

    Appreciate any help I can get.

    Thank you very much in advance!

    You can call the invalidate on your screen method to force the latter to be redrawn.  You should not pop and push a screen just for him having to redraw themselves.

  • Newbie: GridFieldManager ignores HORIZONTAL_SCROLL

    Hi all

    does anyone know a solution for this:

    When I put HORIZONTAL_SCROLL as style for a GridFieldManager I can't horizontal scrolling. The same code with a HorizontalFieldManager works fine. I work with the eclipse BlackBerry plug-in 5.0.0. I already searched the forum but found no solution. I have a feeling this is just a simple mistake. Help, please.

    Thanks for any help in advance.

    Concerning

    Andreas

    Here is a code snippet:

    SerializableAttribute public class MyGFMHScroll extends UiApplication {}
    Public Shared Sub main (String [] args) {}
    PAP MyGFMHScroll = new MyGFMHScroll();
    theApp.enterEventDispatcher ();
    }
    public MyGFMHScroll() {}
    pushScreen (new MyGFMHScrollScreen());
    }
    }
    final MyGFMHScrollScreen class extends form {}
    {MyGFMHScrollScreen()}
    setTitle ("GridFieldManager Horizontal scroll Test");
    HorizontalFieldManager GFM = new HorizontalFieldManager (Manager.HORIZONTAL_SCROLL |) Manager.HORIZONTAL_SCROLLBAR);
    GridFieldManager GFM = new GridFieldManager (1.6, Manager.HORIZONTAL_SCROLL |) Manager.HORIZONTAL_SCROLLBAR);
    GFM. Add (new ButtonField ("button 1"));
    GFM. Add (new ButtonField ("button 2"));
    GFM. Add (new ButtonField "(button 3"));
    GFM. Add (new ButtonField "(button 4"));
    GFM. Add (new ButtonField "(button 5"));
    GFM. Add (new ButtonField "(button 6"));
    Add (GFM);
    }
    }

    Hello friend

    Try this... It will work for scrolling...

    SerializableAttribute public class MyGFMHScroll extends UiApplication {}
    Public Shared Sub main (String [] args) {}
    PAP MyGFMHScroll = new MyGFMHScroll();
    theApp.enterEventDispatcher ();
    }
    public MyGFMHScroll() {}
    pushScreen (new MyGFMHScrollScreen());
    }
    }
    final MyGFMHScrollScreen class extends form {}
    {MyGFMHScrollScreen()}
    Super (HORIZONTAL_SCROLL);
    setTitle ("GridFieldManager Horizontal scroll Test");
    HorizontalFieldManager GFM = new HorizontalFieldManager (Manager.HORIZONTAL_SCROLL |) Manager.HORIZONTAL_SCROLLBAR);

    GridFieldManager GFM = new GridFieldManager (1.6, Manager.HORIZONTAL_SCROLL |) Manager.HORIZONTAL_SCROLLBAR);
    GFM. Add (new ButtonField ("button 1"));
    GFM. Add (new ButtonField ("button 2"));
    GFM. Add (new ButtonField "(button 3"));
    GFM. Add (new ButtonField "(button 4"));
    GFM. Add (new ButtonField "(button 5"));
    GFM. Add (new ButtonField "(button 6"));
    Add (GFM);
    }
    }

  • Difficulties to align LabelFields inside a GridFieldManager

    Hi all!

    As stated in the subject, I can't align inside a gridfieldmanager labelfields.

    I'm confused because I am able to align with BitmapFields using attributes of DraweStyle (TOP, BOTTOM, or LEFT), but that does nothing on LabelFields.

    Again, am I not suppose to use field rather than the DrawStyle attributes attributes? because even on BitmapFields, it does not.

    Here is a simple code with just LabelFields:

    grid = new GridFieldManager(4, 3, Manager.USE_ALL_HEIGHT | Manager.USE_ALL_WIDTH);
    
    grid.setColumnProperty(0, GridFieldManager.AUTO_SIZE, 0);grid.setColumnProperty(1, GridFieldManager.AUTO_SIZE, 0);grid.setColumnProperty(2, GridFieldManager.AUTO_SIZE, 0);
    
    grid.setRowProperty(0, GridFieldManager.AUTO_SIZE, 0);grid.setRowProperty(1, GridFieldManager.AUTO_SIZE, 0);grid.setRowProperty(2, GridFieldManager.AUTO_SIZE, 0);grid.setRowProperty(3, GridFieldManager.AUTO_SIZE, 0);
    
    mainVerticalFieldManager.add(grid);grid.add(new LabelField("----", Field.FIELD_BOTTOM));grid.add(new LabelField("----", Field.FIELD_TOP));grid.add(new LabelField("----", Field.FIELD_LEFT));grid.add(new LabelField("----", Field.FIELD_RIGHT));grid.add(new LabelField("----"));grid.add(new LabelField("----"));grid.add(new LabelField("----"));grid.add(new LabelField("----"));grid.add(new LabelField("----"));grid.add(new LabelField("----"));grid.add(new LabelField("----"));grid.add(new LabelField("----"));
    

    The LabelFields are perfectly horizontally and vertically centered yet they shouldn't.

    I hope someone can help.

    Thank you.

    Welcome on the support forums. If the layout manager is not what you want to achieve, write your own. It is not very difficult and will be very convenient for a long time: http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800508/...

Maybe you are looking for