Field Focusable problem

Hi all

In my program, there is 1 HorizontalFieldManager and 2 AbsoluteFieldManager

Now, I add 2 AFM of HFM and it looks like this

__ ___ __ ___ __ __

|    AFB1 |    AFM2 |

----------------------------

the problem is when I add a buttonField, ButtonField.Focusable in AFM2

When the application is run, the starting point should not be the AFB1 but it's my buttonField

I think that happens because of the buttonfield Focusable

If anyone knows how to fix this help please me, all I want is to ensure that the application starting point will be to first vfm.

Thank you

on the screen display, the first Focus field gets focus.
There are no fields in AFB1, how to get the focus?

You can put a nullfield in this, or any other field focusable.

Tags: BlackBerry Developers

Similar Questions

  • Custom bitmap focus problem with toolbar

    Hi all

    I'm new development of BB.

    I have screen with the title bar and after a toolbar customized

    The custom toolbar contains 3 bitmaps in the side chain and the left text right.

    Logo 'text'---> title bar

    Image1 image2, image3 "screenName"---> toolbar custom

    ListField

    Three images are created using the bitmap.

    I get the focus on the full range.

    But I want to focus on the first image, image1 when the application runs.

    If the user navigates the screen using the keyboard, change of focus to the next image, which is image2 and so on.

    How can I do that.

    I use the Blackberry API 4.2.1

    My current code for the toolbar is like that

    package com.pebbletalk.blackberry.ui;
    
    import com.pebbletalk.blackberry.defines.PTDefines;
    import com.pebbletalk.blackberry.utils.CustomFont;
    
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.DrawStyle;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.component.BitmapField;
    
    public class ToolBar extends Field implements DrawStyle
    {
        private int fieldWidth;
        private int fieldHeight;
        private int backgroundColor;
        private String toolBarName = "";
    
        private Bitmap homeIcon = Bitmap.getBitmapResource("go-home-1_16x16.png");
        private Bitmap searchIcon = Bitmap.getBitmapResource("search-1_16x16.png");
        private Bitmap refreshIcon = Bitmap.getBitmapResource("reload-1_16x16.png");
    
        public ToolBar(String toolbarName)
        {
            super(Field.FOCUSABLE);
            fieldHeight = Display.getHeight()/10;
            fieldWidth = Display.getWidth();
    
            // Setting background color to white
            backgroundColor = Color.BLACK;
    
            toolBarName = toolbarName;
    
        }
    
        public Bitmap getHomeIcon() {
            return homeIcon;
        }
    
        public int getPreferredHeight()
        {
            return fieldHeight;
        }
    
        public int getPreferredWidth()
        {
            return fieldWidth;
        }
    
        protected void layout(int arg0, int arg1)
        {
            setExtent(getPreferredWidth(), getPreferredHeight());
        }
    
        protected void paint(Graphics graphics)
        {
            int height = this.getPreferredHeight();
            int width = this.getPreferredWidth();
    
            int left = this.getLeft();
            int top = this.getTop();
    
            graphics.setColor(backgroundColor);
            graphics.fillRect(0, 0, width, height);
    
            //graphics.drawBitmap(left, top, width, height, homeIcon, 0, 0);
            graphics.drawBitmap(left, 5, width, height, homeIcon, 0, 0);
            //int currentX = graphics.getTranslateX();
            //int currentY = graphics.getTranslateY();
            int homeIconWidth = homeIcon.getWidth() + 5;
            graphics.drawBitmap(homeIconWidth, 5, width, height, searchIcon, 0, 0);
            int searchIconWidth = homeIconWidth + searchIcon.getWidth() + 5;
            graphics.drawBitmap(searchIconWidth, 5, width, height, refreshIcon, 0, 0);
            int refreshIconWidth = searchIconWidth + refreshIcon.getWidth() + 5;
    
            CustomFont titleFont = new CustomFont(Defines.TOOLBAR_DASHBOARD_TITLE_FONT_FACE, Defines.TOOLBAR_DASHBOARD_TITLE_FONT_SIZE, Defines.TOOLBAR_DASHBOARD_TITLE_FONT_STYLE);
            graphics.setFont(titleFont.changeFont());
    
            Font currentFont = graphics.getFont();
            int textLength = currentFont.getAdvance(toolBarName, 0, toolBarName.length());
            textLength += 5;
            System.out.println("width : "+ width);
            System.out.println("refreshIconWidth : "+ refreshIconWidth);
            System.out.println("textLength : "+ textLength);
            int remainingWidth = width - refreshIconWidth;
            System.out.println("remainingWidth : "+ remainingWidth);
            int startPosition = remainingWidth - textLength;
            System.out.println("startPosition : "+ startPosition);
            int newX = refreshIconWidth + startPosition;
            System.out.println("newX : "+ newX);
            //int xPosition = width - refreshIconWidth;
            //System.out.println("tool x : "+ xPosition);
    
            graphics.setColor(PTDefines.TOOLBAR_DASHBOARD_TITLE_COLOR);
            graphics.drawText(toolBarName, newX, 5, (DrawStyle.RIGHT | DrawStyle.LEADING) );
        }
    }
    

    and my toolbarScreen code is

    MainScreen mainScreen = new MainScreen(Screen.NO_VERTICAL_SCROLL);
    
            //MainScreen mainScreen = new MainScreen();
    
            // add custom title bar
            mainScreen.add(titleBar);
    
            VerticalFieldManager verticalFieldManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR)
            {
                public void paint(Graphics graphics)
                {
                    graphics.setBackgroundColor(Color.WHITE);
                    graphics.clear();
                    super.paint(graphics);
                }
                protected void sublayout(int maxWidth, int maxHeight)
                {
                    int displayWidth = Display.getWidth();
                    int displayHeight = Display.getHeight() - titleBarHeight;
                    super.sublayout(displayWidth, displayHeight);
                    setExtent(displayWidth, displayHeight);
    
                }
            };
    
            //now add everything in the verticalManager
    
            // add custom toolbar
            mainScreen.add(toolBar);
            mainScreen.add(new SeparatorField());
    

    Please help me to solve my problem.

    Remember that the BlackBerry smartphone focuses on a field, not a picture.  Your toolbar is only a field, so one thing to focus on which is the Blackberry's.

    You have two choices:

    (a) change your toolbar to be a Manager and have several fields that it contains.  You can make a HorizontalFieldManager and assuming that the other things are set correctly (in particular the width of the fields that you add) this will do what you want.

    (b) substitute events in development movement in your toolbar to make it appear focus is moved.

    I think the second option is more difficult, especially when you start to take the touch screen into consideration.  However, with the second option, you get a much easier control over the look of your toolbar.  But I'd go with the first one, as I think it is easier for new programmers.  Initially, I wouldn't get to hung up on the appearance of the toolbar, get it works the way you want and then try to get it looking right.

  • Rich text field, scroll problems

    Hello world

    I currently have a problem with the rich text fields.  I have a selected rich when custom text field (onFocus), it colors the blue text when not selected (onUnfocus), the text is white.

    I have Setup several of my RichTextFields in a VerticalFieldManager so they can be scrolled as a list.

    Now scrolling works on the following simulators:

    Bold 9000 4.6.0.266

    Curve 8520 4.6.1.272

    But no scrolling does work on this Simulator:

    Bold 9700 5.0.442

    What Miss me?  I know the o/s changed, but if it should not be backward compatible?

    I use Blackberry JDE component Package 4.2.1

    Any help would be greatly appreciated.

    I found the problem.  The super I was calling was super (text, Field.FOCUSABLE), this caused the 9700 Simulator not to focus the richtextfields.

    The Builder suitable for call is super (Field.FOCUSABLE), and that fixed the issue.

    Now, I have another problem.  Suddenly, I added a few images, the background (they are all less than 300 KB) tested on simulators of 9000 and 8520, it worked.

    When I test it on the 9700, it says net.rim.device.api.system.Application not found

    Hint anyone?

  • Infinity focusing problem on my SX700

    I always infinity focusing problems with my SX700.  I have the yellow box indicating that the image will be sweet if taken.  This happens on at least 1 other point cannon and shoot that I know.  I can focus to several hundred feet but not 10 000.  Does anyone else have this problem?  I am at my end and ready to jump ship to another manufacturer if I can't get to the bottom of this.  I never had this problem with my G-10.  Could this be a problem with extreme telephoto lens Canon point and shoot models?

    I have a Canon PowerShot SX150is and a Canon PowerShot G12, and I get the same questions. Here's what I learned. The problem with any long zoom point and shoot at the tele end is the amount of contrast detection that occurs to allow the development. With shorter zooms, the atmosphere is less dense, but more zooms to detect the density of the air. This is particularly noticeable on days with higher humidity levels, but would not have noticed the days of low humidity very dry. So the blur warning you get. The camera is not getting enough contrast to narrow the focus. No matter what brand you use, if the camera uses contrast detect focus, it will be the result. Not all use contrast detect, so be sure to check before you choose "deserting a ship."

    I would keep the ISO as low as possible, and if you can manually set the focus to infinity, it should help. But this has always been a sore spot with me on cameras Canon PowerShot with how long and complex manual focus is. Hope this helps you understand what may be the problem you are experiencing.

    Steve M.

  • Field focuses do not

    Hello

    For me RichTextField get does not it comes by default white background and black text. So please help me to fix the sentence. Why he isn't getting focused with the specified color.

    Here is the code I use.

     Phone = new ExRichTextField(sphone){
                int _bgColor;
                int _txtcolor;
                    public void onFocus(int direction) {
                  _bgColor = Color.ORANGE;
                  _txtcolor=Color.BLACK;
                      invalidate();
                      super.onFocus(direction);
                       Phone.setPhoneNumber(sphone);
                        Phonenumber=this.getPhoneNumber();
                         s.addMenuItem(new MenuItem("call",1,1) {
    
       public void run() {
        makeCall(Phonenumber);
    
       }
      });
    
           }
    
           public void onUnfocus() {
                  super.onUnfocus();
                 _bgColor = Color.ALICEBLUE;
                 _txtcolor=Color.BLACK;
                    invalidate();
                    s.removeAllMenuItems();
           }
    
                               public void paint(Graphics g) {
                                   g.setColor(_bgColor);
                                   g.setColor(_txtcolor);
                                    super.paint(g);
                            }
                    };
    
    class ExRichTextField extends RichTextField {
    
                public ExRichTextField(String text) {
                    super(text,Field.FOCUSABLE);
    
            }
    
    }
    

    I have trouble reading your code, because you seem to have a combination of substitutions that I'm not sure.  Here is an example which I think is what you want in terms of development.  You can find a way add/remove the item from the menu in this treatment.

    class ExRichTextField extends RichTextField {
        int _bgColor = Color.ALICEBLUE; // initially unfocused
        int _txtcolor = Color.BLACK;
    
        public ExRichTextField(String text) {
            super(text,Field.FOCUSABLE);
        }
    
        public void onFocus(int direction) {
            super.onFocus(direction);
            _bgColor = Color.ORANGE;
            _txtcolor=Color.BLACK;
            invalidate();
        }
    
        public void onUnfocus() {
            super.onUnfocus();
            _bgColor = Color.ALICEBLUE;
            _txtcolor=Color.BLACK;
            invalidate();
        }
    
         public void paint(Graphics g) {
             g.setBackgroundColor(_bgColor);
             g.clear();
             g.setColor(_txtcolor);
             super.paint(g);
         }
    
    }
    
  • Custom ButtonField Field.FOCUSABLE + Field.FIELD_HCENTER

    I am doing a custom button class that can change the color of the button when it is concentrated AND make it Central on the screen, I can make one of these but not both.

    This is the constructor for the class CustomButtonField

       public CustomButtonField(String text){
            super(Field.FOCUSABLE);
            this.text = text;
            //this.highlightColour = 0x18333C;
            FontFamily fFam = null;
            try {
                fFam = FontFamily.forName("Arial");
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
                    Font font = fFam.getFont(Font.PLAIN, 20);
            Font defaultFont = font;
            fieldHeight = defaultFont.getHeight() + padding;
            fieldWidth = defaultFont.getAdvance(text) + (padding * 2);
            this.setPadding(2, 2, 2, 2);
    
        }
    

    Evolution:

    Super (Field.FOCUSABLE)

    TO

    Super (Field.FIELD_HCENTER)

    allows me to do the other, but not both at the same time, all clues?

    Thank you!

    Super(Field.FOCUSABLE |) Field.FIELD_HCENTER);

  • Focus problems

    Hello

    I spent a lot of time trying to figure out what was causing a weird problem that is a few clicks away from buttons are ignored. After doing some tests I ran into components compiled Clip. If I remove them from the library that the update works as I expect. The problem is that I don't want (and don't have the time to) create or find replacements for all of the Compiled clips I used in this project.

    Does anyone know how to overcome this problem without removing these components?

    I've created a simple example to show you guys the problem we have here.

    If you compile the code and run the application (slider.fla and problemCompiledClip.fla), then click on in the textField (to set the focus to the subject), you will see the focus remains in the textField component when you click the buttons. I don't want this behavior, I would like the update in the... invisible buttons.

    Now, if you go to the library (on problemCompiledClip.fla) and delete component ProgressBar which is not yet used, the behaviour you will get is that I want to achieve. This is the average, even if the focus is in the textField and then you click any button, the object disappears from the textField object. Who do ALL the events of clicks in the buttons of her captured.

    If I wasn't clear on the problem, let me know.

    Thank you very much
    See you soon

    the source code is here: http://www.actionscript.org/forums/showthread.php3?p=614213#post614213

    I use components if I am unable to get detailed help. but I know that this problem has been discussed in this forum and, I think, using the component development manager led to a resolution of the problem.

    Try this forum looking for something like focus problems. most of the people who encounter this problem do not realize it is a problem of component and if the components are not mentioned in their section of wire or a subtopic.

  • Problem in the scroll bars when the screen is not any field focus...

    Hi all

    I have a screen on which I need to display a list of items. and the list total appears at the bottom of the list. everything works fine if the lily a few number of lines. but as soon as the number of rows and Lily exceeds the length of the screen, there is the problem. I don't see the total at the bottom because I can't scroll the list. Here is the code in my class. in the class list, I use a CustomGridManager, which shows data in a table (I downloaded it). I made a few changes in the present. the code for this handler is also attached. Please tell me what changes should I make, so that the screen can be the object of a scroll. (Please go through the code)...

    SerializableAttribute public class MyClass extends {screen

    public MyClass (dataList DataList []) {}

    Super(Manager.VERTICAL_SCROLLBAR |) Manager.VERTICAL_SCROLL);

    Super();

    int noOfColumns = 2;

    int noOfRows = dataList.length;

    int [] columnWidth = {50.50};

    CustomGridManager gfmHeader = new CustomGridManager (noOfColumns, 0, columnWidth);

    Adding headers

    LabelField lblHdrCol1 = new LabelField ("Col1");

    gfmHeader.add (lblHdrCol1);

    LabelField lblHdrCol2 = new LabelField ("Col2");

    gfmHeader.add (lblHdrCol2);

    VerticalFieldManager vfmTitle = new VerticalFieldManager();

    vfmTitle.add (new LabelField ("my class"));

    vfmTitle.add (gfmHeader);

    setTitle (vfmTitle);

    Addition of body

    GFM CustomGridManager = new CustomGridManager (noOfColumns, 0, columnWidth);

    for (int i = 0; i)< noofrows;="">

    LabelField lblICol1 = new LabelField (dataList [i] .getCol1 ());

    GFM. Add (lblICol1);

    LabelField lblICol2 = new LabelField (dataList [i] .getCol2 ());

    GFM. Add (lblICol2);

    Adding a footer

    CustomGridManager gfmFooter = new CustomGridManager (noOfColumns, 0, columnWidth);

    LabelField lblFtrTotal = new LabelField ("Total");

    gfmFooter.add (lblFtrTotal);

    LabelField lblFtrValue = new LabelField ("CalculatedValue");

    gfmFooter.add (lblFtrValue);

    Add (gfmHeader);

    Add (new SeparatorField());

    Add (GFM);

    Add (new SeparatorField());

    Add (gfmFooter);

    Add (new SeparatorField());

    }

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

    SerializableAttribute public class CustomGridManager extends Manager {}

    private int [] columnWidths;

    private int [] staticColumnWidth;

    private int columns;

    private int allRowHeight = - 1;

    /**

    * Built a new CustomGridManager with the number of columns specified.

    * Lines will be added to the need to display the fields.

    * Fields will be added to the grid in the order they are added to this Manager.

    to complete each row from left to right:

    *

    * For example, a Manager 2 column:

    *

    * [Field1] [Field2]

    * [Field3] [Field4]

    * [Sphere5]

    *

    * Column widths are equal, and the Manager will attempt to use the entire available width.

    Each line height will be equal to the height of the field higher in the same row.

    * Styles positional field are met, then the fields that are smaller than the row/column

    * they can be set to left, right, up down, or centered. They have by default at the top left.

    *

    @param columns number of columns in the grid

    @param style

    */

    public GridFieldManager (columns int, long style) {}

    Super(Manager.VERTICAL_SCROLLBAR |) Manager.VERTICAL_SCROLL);

    Super (style);

    This.colonnes = columns;

    }

    /**

    *

    @param columns columns number of columns in the grid

    @param style

    @param columnWidths width of each column in a table

    */

    public GridFieldManager (columns int, long style, int [] columnWidths) {}

    Super(Manager.VERTICAL_SCROLLBAR |) Manager.VERTICAL_SCROLL);

    Super (style);

    This.colonnes = columns;

    this.staticColumnWidth = columnWidths;

    }

    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}

    f.setFocus ();

    -DY;

    }

    }

    }

    While (dy< 0)="">

    focusIndex = columns;

    If (focusIndex< 0)="">

    Returns false;

    }

    else {}

    Field f = getField (focusIndex);

    If (f.isFocusable ()) {}

    f.setFocus ();

    DY ++;

    }

    }

    }

    While (dx > 0) {}

    focusIndex ++;

    {If (focusIndex > = {getFieldCount())}

    Returns false;

    }

    else {}

    Field f = getField (focusIndex);

    If (f.isFocusable ()) {}

    f.setFocus ();

    -DX;

    }

    }

    }

    While (dx< 0)="">

    -focusIndex;

    If (focusIndex< 0)="">

    Returns false;

    }

    else {}

    Field f = getField (focusIndex);

    If (f.isFocusable ()) {}

    f.setFocus ();

    DX ++;

    }

    }

    }

    Returns true;

    }

    protected void sublayout (int width, int height) {}

    int y = 0;

    columnWidths = new int [columns];

    If (staticColumnWidth == null: staticColumnWidth.length)<= 0)="">

    for (int i = 0; i)< columns;="" i++)="">

    columnWidths [i] = width/columns;

    }

    } else {}

    for (int i = 0; i)< columns;="" i++)="">

    columnWidths [i] = (width * staticColumnWidth [i]) / 100;

    }

    }

    On the field [] fields = Field [new columnWidths.length];

    currentColumn int = 0;

    rowHeight = 0 int;

    for (int i = 0; i)< getfieldcount();="" i++)="">

    fields [currentColumn] = getField (i);

    layoutChild (fields [currentColumn], columnWidths [currentColumn], height-y);

    If (fields [currentColumn] .getHeight () > rowHeight) {}

    rowHeight = fields [currentColumn] .getHeight ();

    }

    currentColumn ++;

    {If (currentColumn == columnWidths.length | I == {getFieldCount () - 1)}

    int x = 0;

    If (this.allRowHeight > = 0) {}

    rowHeight = this.allRowHeight;

    }

    for (int c = 0; c)< currentcolumn;="" c++)="">

    long fieldStyle is fields [c] .getStyle ();.

    int fieldXOffset = 0;

    long fieldHalign = fieldStyle & Field.FIELD_HALIGN_MASK;

    If (fieldHalign == Field.FIELD_RIGHT) {}

    fieldXOffset = columnWidths [c] - fields [c] .getWidth ();

    }

    Else if (fieldHalign == Field.FIELD_HCENTER) {}

    fieldXOffset = (columnWidths [c] - fields [c] .getWidth ()) / 2;

    }

    int fieldYOffset = 0;

    long fieldValign = fieldStyle & Field.FIELD_VALIGN_MASK;

    If (fieldValign == Field.FIELD_BOTTOM) {}

    fieldYOffset = rowHeight - fields [c] .getHeight ();

    }

    Else if (fieldValign == Field.FIELD_VCENTER) {}

    fieldYOffset = (rowHeight-fields [c] .getHeight ()) / 2;

    }

    setPositionChild (fields [c], x + fieldXOffset, y + fieldYOffset);

    x += columnWidths [c];

    }

    currentColumn = 0;

    y += rowHeight.

    }

    If (y > = height) {}

    break;

    }

    }

    totalWidth int = 0;

    for (int i = 0; i)< columnwidths.length;="" i++)="">

    totalWidth += columnWidths [i];

    }

    setExtent (totalWidth, Math.min (y, height));

    }

    }

    Do you really want now fields is active.

    You can try adding a NullField after your Manager - a NullField is active, if it does not size.

    Other than that, you can try the substitution of navigationMovement and Manager.setVerticalScroll to go up and down the window scrolling.  I think it should work, although I never did.  You can control the scope of the first Manager to ensure that you do not have to scroll through to the end.

  • List of the HorizontalFieldManager with scrolling focus problem

    Hello

    I'm doing a vertical list of horizontalfieldmanager with an icon and two text fields, but I'm having a problem when scrolling it. I used a nullField to manage focus. When I scroll to the top everything works well, but when I Ahmed to the bottom of the item appears on the edge of the screen.

    I guess that I did not understand how to manage the focusChange metodh and the metodh of the painting.

    All advice will be appreciated.

    Thank you, Andrea.

    //
        // Main screen for the application
        //
        private class MyMainScreen extends MainScreen
        {
            public MyMainScreen()
            {
                super(Manager.USE_ALL_WIDTH);
    
                for (int i = 0; i<20; i++) this.getMainManager().add(new PanelRow("off", "first text line", "second text line"));
            }
    
            private class PanelRow extends HorizontalFieldManager implements FocusChangeListener
            {
                private NullField nullField;
                private BitmapField icon;
                private ColorLabelField label1;
                private ColorLabelField label2;
    
                public PanelRow(String iconString, String label1String, String label2String)
                {
                    super(Manager.USE_ALL_WIDTH);
    
                    // Add null field
                    nullField = new NullField(NullField.FOCUSABLE);
                    nullField.setFocusListener(this);
                    super.add(nullField);
    
                    // Add bitmap
                    Bitmap offIcon = Bitmap.getBitmapResource("offButton.png");
                    icon = new BitmapField(offIcon, BitmapField.NON_FOCUSABLE | BitmapField.FIELD_LEFT);
                    super.add(icon);
    
                    // Add first and second text lines
                    VerticalFieldManager labelsVerticalManager = new VerticalFieldManager();
                    label1 = new ColorLabelField(label1String, LabelField.NON_FOCUSABLE | LabelField.FIELD_LEFT);
                    label2 = new ColorLabelField(label2String, LabelField.NON_FOCUSABLE | LabelField.FIELD_LEFT);
                    labelsVerticalManager.add(label1);
                    labelsVerticalManager.add(label2);
                    super.add(labelsVerticalManager);
                }
    
                public void focusChanged(Field field, int eventType)
                {
                    invalidate();
                }
    
                protected boolean navigationClick(int status, int time)
                {
                    fieldChangeNotify(FieldChangeListener.PROGRAMMATIC);
    
                    return true;
                }
    
                protected void paint(Graphics g)
                {
                    int oldBackground = g.getBackgroundColor();
    
                    if (nullField.isFocus())
                    {
                        g.setBackgroundColor(Color.CADETBLUE);
    
                        label1.setFontColor(Color.WHITE);
                        label2.setFontColor(Color.WHITE);
                    }
                    else
                    {
                        g.setBackgroundColor(Color.WHITE);
    
                        label1.setFontColor(Color.SLATEGRAY);
                        label2.setFontColor(Color.BLACK);
                    }
    
                    g.clear();
    
                    g.setBackgroundColor(oldBackground);
    
                    super.paint(g);
                }
            }
    
            //
            // Define a new colored labelfield class
            //
            public class ColorLabelField extends LabelField
            {
                public ColorLabelField(Object text, long style)
                {
                    super(text, style);
                }
    
                private int mFontColor = -1;
    
                public void setFontColor(int fontColor)
                {
                    mFontColor = fontColor;
                }
    
                protected void paint(Graphics graphics)
                {
                    if (-1 != mFontColor) graphics.setColor(mFontColor);
    
                    super.paint(graphics);
                }
            }
        }
    

    Then try to create your NullField with getFocusRect override: like this:

    nullField = new NullField(NullField.FOCUSABLE) {
      public void getFocusRect(XYRect rect) {
        getManager.getExtent(rect);
        rect.setLocation(0, 0);
      }
    };
    

    Paint won't help you - you must tell the system to the entire span developed in order to scroll properly. If the above fails, analyze your focusChanged eventType and make sure that your Manager is fully visible on the screen on FOCUS_GAINED. To do this, you need to use getManager () .getVerticalScroll () / getManager () .setVerticalScroll () as well as of your Manager and getHeight() getTop().

  • Output field Focus

    I have a RichText field inside a VerticalFieldManager.  This value for money takes only a few lines.  I have two of them on the screen.  When I scroll using the wheel she starts most by the Senior Manager of VFM and scroll all the way to the bottom of the text in text VFM most high field before moving the low VFM Textbox.  Because text fields can have a large amount of text in there it takes a long time to go through all the text in the top of the page value for money before I go down one.  I would like to navigationMovement and if the text box has not been clicked then just move to the next text box.  The user can then move between the two and click never who he or she wants to read by clicking on it.  I need to be able to give up the selection or focus within navigationMovement.  I tried focusRelease and setFocus.  Maybe I need to do on the screen rather than on the optimization of resources.

    Any help would be greatly appreciated.  I can post code samples if that would help.

    Thanks in advance.

    Peter thank you very much for your contribution.

    I placed the invokelater in the onfocus method and it works actually pretty good.

    This is my first java program and the first blackberry application, so I don't know that I'm not always the straight line.

    I'm still trying to get use to the memory management model.  I can new the executable thread in the onFocus event?  It runs only once and I have no concern for leaks and memory fragmentation?  Also do not know how the run() method actually gets my VOR 'this->' pointer but he does.  Its similar magic.

    In any case, I don't want to accept this as a solution, I again thank you and I will post the three methods that I placed on my VerticalFieldManager that contains a single field to RichText.

    Maybe someone else has problems with the setVerticalScroll not taking effect.

        protected void onFocus(int direction)
        {
            super.onFocus(direction);
    
            //  Need to call setVerticalScroll a little later.  It looks like
            //  setFocus is overriding it.  If we call it later then it will
            //  actually take effect.
            UiApplication.getUiApplication().invokeLater(
                new Runnable()  {
                    public void run()   {
                        setVerticalScroll(m_iCurrentLine * m_iFontHeight);
                    }
                });
        }
    
        protected boolean navigationClick(int status, int time)
        {
            m_bScrollEnabled = m_bScrollEnabled == true ? false : true;
            return  true;
        }
    
        protected boolean navigationMovement(int dx, int dy, int status, int time)
        {
            if  (m_bScrollEnabled == true)
            {
                int     i_scrolloff =   (m_iCurrentLine + dy) * m_iFontHeight;
                if  (i_scrolloff < 0 || (i_scrolloff + getVisibleHeight()) > getVirtualHeight())
                    return  true;       //  Eat the scroll event cause we're at the beginning or end
    
                m_iCurrentLine      +=  dy;
                setVerticalScroll(i_scrolloff);
                return  true;
            }
            else
            {
                //  If here then RichText field is not selected
                //  figure out which field currently has focus
                //  and move focus to next field
                Screen  scr         =   getScreen();
                int     i           =   scr.getFieldWithFocusIndex();
                Field   field       =   (i == (scr.getFieldCount() - 1)) ? scr.getField(0) : scr.getField(i + 1);
                field.setFocus();
            }
            return  false;
        }
    
  • ListField focus problem.

    Hi people,

    I have a problem with listfield focus. in the 8900 v4.6.1, the last update does not disappear when I select a new line.

    Do the invalidate in line works, but navigation has become with the slow performance.

    Code:

    package mypackage;
    
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Hashtable;
    import java.util.Vector;
    
    import javax.microedition.lcdui.Font;
    
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.component.ListField;
    import net.rim.device.api.ui.component.ListFieldCallback;
    import net.rim.device.api.ui.decor.BackgroundFactory;
    
    public final class HelpScreen extends CustomMainScreen {
        protected boolean onSavePrompt() {
            try {
                save();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                System.err.println("Excecao HelpScreen 1 " + e.getClass() + " - " + e.getMessage());
                e.printStackTrace();
            }
            return true;
        }
    
        private Vector content = null;
        private ListHelpScreen callback;
    
        public HelpScreen() {
    
            // System.out.println("HelpScreen");
    
            setBanner(new BitmapField(Bitmap.getBitmapResource(ScreenManager.getStringProperty("helpscreen.banner"))));
            setBackground(BackgroundFactory.createSolidBackground(0x434343));
            content = getVector();
    
            ListField list = initCallbackListening();
    
            list.setSize(content.size());
            // list.setRowHeight(62);
            int rowheight = ScreenManager.getPositionAtKey("helpscreen.listfield.rowheight");
    
            list.setRowHeight(rowheight);
            add(list);
            LabelField copyright = new LabelField("Cielo Mobile " + ServerRequests.version + "\n" + "© Todos os direitos reservados",
                    Field.USE_ALL_WIDTH) {
                protected void paint(Graphics graphics) {
                    graphics.setColor(Color.WHITE);
                    super.paint(graphics);
                }
    
            };
            copyright.setBackground(BackgroundFactory.createSolidBackground(0x434343));
            copyright.setPadding(ScreenManager.getPositionAtKey("helpscreen.copyright.padding.top"),
                    ScreenManager.getPositionAtKey("helpscreen.copyright.padding.right"),
                    ScreenManager.getPositionAtKey("helpscreen.copyright.padding.bottom"),
                    ScreenManager.getPositionAtKey("helpscreen.copyright.padding.left"));
            copyright.setPosition(ScreenManager.getPositionAtKey("helpscreen.copyright.position"));
    
            copyright.setFont(getFont().derive(Font.STYLE_PLAIN, 14));
    
            add(copyright);
    
        }
    
        private Vector getVector() {
            Vector menuItems = new Vector();
            Hashtable currentElement = new Hashtable();
            Class classs = null;
            try {
                classs = Class.forName(this.getClass().getName());
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                System.err.println("Excecao HelpScreen 2 " + e.getClass() + " - " + e.getMessage());
                e.printStackTrace();
            }
            InputStream stream = classs.getResourceAsStream("/fraseologia.properties");
            PropertiesUtil properties = new PropertiesUtil();
            try {
                properties.load(stream);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                System.err.println("Excecao HelpScreen 3 " + e.getClass() + " - " + e.getMessage());
                e.printStackTrace();
            }
            currentElement.put("title", "1 " + ((String) properties.getProperties().get("pergunta1")).toUpperCase());
            menuItems.addElement(currentElement);
    
            currentElement = new Hashtable();
            currentElement.put("title", "2 " + ((String) properties.getProperties().get("pergunta2")).toUpperCase());
            menuItems.addElement(currentElement);
    
            currentElement = new Hashtable();
            currentElement.put("title", "3 " + ((String) properties.getProperties().get("pergunta3")).toUpperCase());
            menuItems.addElement(currentElement);
    
            currentElement = new Hashtable();
            currentElement.put("title", "4 " + ((String) properties.getProperties().get("pergunta4")).toUpperCase());
            menuItems.addElement(currentElement);
    
            currentElement = new Hashtable();
            currentElement.put("title", "5 " + ((String) properties.getProperties().get("pergunta5")).toUpperCase());
            menuItems.addElement(currentElement);
    
            currentElement = new Hashtable();
            currentElement.put("title", "6 " + ((String) properties.getProperties().get("pergunta6")).toUpperCase());
            menuItems.addElement(currentElement);
    
            currentElement = new Hashtable();
            currentElement.put("title", "7 " + ((String) properties.getProperties().get("pergunta7")).toUpperCase());
            menuItems.addElement(currentElement);
    
            currentElement = new Hashtable();
            currentElement.put("title", "8 " + ((String) properties.getProperties().get("pergunta8")).toUpperCase());
            menuItems.addElement(currentElement);
            //
            // currentElement = new Hashtable();
            // currentElement.put("title", "Cielo Mobile " + ServerRequests.version);
            // currentElement.put("text", "© Todos os direitos reservados");
            // menuItems.addElement(currentElement);
    
            return menuItems;
        }
    
        private ListField initCallbackListening() {
            callback = new ListHelpScreen();
            ListField listField = new ListField() {
    
                protected boolean navigationClick(int status, int time) {
                    // TODO melhorar essa logica
                    if (this.getSelectedIndex() < 8) {
                        UiApplication.getUiApplication().pushScreen(new AnswersScreen(this.getSelectedIndex()));
                    }
    
                    return true;
                }
            };
            listField.setCallback(callback);
            listField.setFont(this.getFont().derive(Font.STYLE_PLAIN, 16));
    
            // listField.setRowHeight(-3);
            return listField;
        }
    
        private class ListHelpScreen implements ListFieldCallback {
            private int lastIndex = 0;
    
            public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width) {
    
                Hashtable currentCellInformations = ((Hashtable) content.elementAt(index));
    
                Bitmap image = null;
                if (index == listField.getSelectedIndex()) {
                    image = Bitmap.getBitmapResource(ScreenManager.getStringProperty("helpscreen.listfieldcallback.image.hint"));
                } else {
                    image = Bitmap.getBitmapResource(ScreenManager.getStringProperty("helpscreen.listfieldcallback.image"));
                }
    
                graphics.drawBitmap(0, y, image.getWidth(), image.getHeight(), image, 0, 0);
    
                String text = (String) currentCellInformations.get("title");
                graphics.setColor(Color.WHITE);
                graphics.drawText(text, ScreenManager.getPositionAtKey("helpscreen.listfieldcallback.inicialoffset.x"),
                        ScreenManager.getPositionAtKey("helpscreen.listfieldcallback.inicialoffset.y") + y);
                 listField.invalidate(lastIndex);
                lastIndex = index;
            }
    
            public Object get(ListField listField, int index) {
                return content.elementAt(index);
            }
    
            public int getPreferredWidth(ListField listField) {
                return ScreenManager.getPositionAtKey("helpscreen.listfieldcallback.preferredwidth");
            }
    
            public int indexOfList(ListField listField, String prefix, int start) {
                return content.indexOf(prefix, start);
            }
        }
    }
    

    Could you help me please with other alternatives?

    Thanks in advance.

    It was the solution for me

    ListField listField = new ListField() {
                private int lastIndex = 0;
    
                public int moveFocus(int amount, int status, int time) {
                    lastIndex = getSelectedIndex();
                    invalidate(lastIndex);
                    return super.moveFocus(amount, status, time);
                }
    

    Thank you!!!

  • In the view tab focus problem.

    Hello friends,

    I tried the sample screen tab. I got it at the following link (credit goes to original encoder).

    http://supportforums.BlackBerry.com/rim/attachments/rim/java_dev@tkb/175/3/TabControl.Java

    I made a few changes in the code so that the area of the lower screen is displayed when you click the respective tabs.

    When I click on the first tab, it displays the screen for the first tab, in the same way when I click on the second tab, it shows the screen for the second tab like this. BUYMD the problem that I face is... When I click on the first tab it shows the screen on the first tab. When I scroll to the screen area (which is another vertical field Manager) and still try to go to the higher HorizontahlFieldManager, the focus goes to the last tab (even if the first tab is selected.

    I want the focus to go directly to the selected tab.

    How can I achieve this?

    Thank you

    You will need to remember where emphasis was put before his departure from the Manager tab and go back when the manager gets the focus again. Make it implement FocusChangeListener and listen to its own changes of focus. On FOCUS_GAINED, check if the registered lastFocused field is not null; If this is not setFocus (wrap in invokeLater), otherwise register the domain that currently has the focus. On FOCUS_CHANGED, simply register the domain that currently has the focus. You have nothing to do on FOCUS_LOST.

  • window focus problems

    Hello fellow travelers... Since the update to 10.11.5 I have problems with windows does not come to the front when you click on to and does not come to be the focused window. No left or right mouse clicks don't work in the window. I have to close and reopen a window to make it sensitive. I also get error messages stating that the audio files cannot be changed because they are read-only. I read in the Infolog & right of authorization user and administrator. The files are on an external drive and were available in os 10.9.5. Any ideas?

    See if start-up aid.

    Stop your Mac. Start with the SHIFT key is pressed. This will start in Safe Mode, with all extensions turned off. Safe mode is slow to comlete, so give it time, he checks a lot of staff. If it works fine in Safe Mode, restart normally.

  • Astrophotography Focus problem

    Hello I have the NEX 6 (with the SALT 50 mm F1.8 lens) and most of the time to enjoy. I bought it mainly for astrophotography and need tips for image correctly targeted (during playback or downloaded on my computer). I can't seem to get a clear focus, on the LCD or electronic viewfinder, but reading and uploaded images are not as well doors. I take several images focus, but no adjustment of the scope or the camera make attention the final result. This problem is the same in all forms of astrophotography, home, eyepiece projection and imaging of the camera.

    What camera modes are best for this Live View configuration effect i.e? I tried to use peki Focus, but is not effective for these low light objects like planets. Even the Moon images suffer from the same problem.

    I tried pre-focus the camera to infinity by placing it on a tripod or grafted onto the stand using MF Assist and the scope for a 'infinite '. THA has not helped either. I tried techniques, proposed on the astro sites, such as the use of high ISO focus, wearing different glasses (and set the diopter adjustment VIEWFINDER accordingly) and reset the ISO for the shhot. none available seems to help. What suggestions do you have?

    Thanks in advance for any assistance with this problem.

    I would recommend that you enable the setting [before Shutter curtain]. This function is intended to shorten the time lag between the shutter by reducing the movement of the shutter mechanism.

    Vibration caused by the shutter must be quite negligible not because of blur your images. Please check if the images taken with the Shutter curtain before setting enabled and disabled will have any differences. If the subject (e.g. stars) move, slight blurring occurs when you use a slow shutter speed.

    If my post answered your question, please mark it as "accept as a Solution.

  • random auto focus problem Canon EF-S 18-55

    Hello

    I have worked with Canon EF-S 18-55 IS NO Lenes and have found a problem that I just can't seen to solve. The problem is I get autofocus, but at times it will not focus. I changed the card with a known good, engine Assembly, contacts with good looking for work units but not the contact Strip because they seem good.

    The Assembly moves freely with little resistance. I've also seen this problem on the IS versions too but especially on versions IS.

    I'm looking for any other suggestions that could solve the problem.

    Well I finally found out what the problem was and fixed 3 Lenes.

Maybe you are looking for