Development/unfocus HorizontalFieldManager problem

I do this on a HorizontalFieldManager to focus and unfocus color and his works fine. But my doubt is that even if I do my style of hfm like NON_FOCUSABLE, it always shows the unfocus color focus which shudnt be the case. Kindly help

protected void paintBackground(Graphics g) {
        if (isFocus()) {
            int[] drawColors = { 0x1a66b4, 0x1a66b4, 0x1a66b4, 0x1a66b4, 0x1a66b4, 0x1a66b4, 0x4b80b7, 0x4b80b7, 0x4b80b7, 0x4b80b7, 0x4b80b7, 0x4b80b7 };
            g = Gradient.draw(g, mHeight, mWidth, drawColors);
        } else {
            int[] drawColors = { color, color, color,color,color,color,color,color,color,color,color,color};
            g = Gradient.draw(g, mHeight, mWidth, drawColors);

    protected void drawFocus(Graphics graphics, boolean on) {

    public void onFocus(int direction) {


Hey I solved it

Tags: BlackBerry Developers

Similar Questions

  • Custom development/unfocus listfield problem

    Hi guys,.

    I followed and adapted a few custom listfield and produced the code below. The layout fields works exactly as I intended, however, I ran into problems to repaint when the focus changes as I scroll around the fields.

    Scroll down the first elements in the list, focus changes as it should. When the focus switches to the listfield, who is at the bottom of the screen (as in the last field that is displayed, not necessarily the last field in the list), the target element is displayed correctly, but the text of all the other fields is preparing to the color that the target text must be. The fuzzy text remains then the color targeted until I do scroll up even once, when he again changes in how it should be.

    Sorry if it is not very clear... I can post screenshots if it's not understandable!

    The code used is the following:

    ListField custom

    public class MatchListField extends ListField implements FieldChangeListener
        private boolean hasFocus;
        private static final int LIGHT_TEXT  = 0xe6ce03;
        private static final int DARK_TEXT  = 0x054b93;
        private final int[] cols = new int[]{ 0xe6ce03, 0xf9f1af, 0xf9f1af, 0xe6ce03 };
        public MatchListField()
            setRowHeight( 50 );
        public int moveFocus(int amount, int status, int time)
            return super.moveFocus(amount,status,time);
        public boolean isFocusable()
            return true;
        //Invoked when this field receives the focus.
        protected void onFocus(int direction)
            hasFocus = true;
        //Invoked when a field loses the focus.
        protected void onUnfocus()
            hasFocus = false;
        protected void paint( Graphics graphics )
            //Get the current clipping region as it will be the only part that requires repainting
            XYRect redrawRect = graphics.getClippingRect();
            if(redrawRect.y < 0)
                throw new IllegalStateException("Clipping rectangle is wrong.");
            //Determine the start location of the clipping region and end.
            int rowHeight = getRowHeight();
            int curSelected;
            //If the ListField has focus determine the selected row.
            if (hasFocus)
                 curSelected = getSelectedIndex();
                curSelected = -1;
            int startLine = redrawRect.y / rowHeight;
            int endLine = ( redrawRect.y + redrawRect.height - 1 ) / rowHeight;
            endLine = Math.min( endLine, getSize() );
            int y = startLine * rowHeight;
            //Setup the data used for drawing.
            int[] yInds = new int[]{y, y, y + rowHeight, y + rowHeight};
            int[] xInds = new int[]{0, getPreferredWidth(), getPreferredWidth(), 0};     
            //Draw each row
            for( ; startLine <= endLine; startLine++ )
                if (startLine != curSelected)
                    //Draw the non selected rows.
                    graphics.setColor( LIGHT_TEXT );
                    super.paint( graphics );
                    //Draw the selected rows.
                    graphics.drawShadedFilledPath( xInds, yInds, null, cols, null );
                    graphics.setColor( DARK_TEXT );
                    super.paint( graphics );
                //Assign new values to the y axis moving one row down.
                y += rowHeight;
                yInds[0] = y;
                yInds[1] = yInds[0];
                yInds[2] = y + rowHeight;
                yInds[3] = yInds[2];

    Custom ListFieldCallback:

    public class MatchListCallback implements ListFieldCallback {
        private Vector _listElements = new Vector();
        public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width)
            MatchListField matchList = ( MatchListField ) listField;
            MatchListRowManager rowManager = ( MatchListRowManager ) _listElements.elementAt( index );
            rowManager.drawRow( graphics, 0, y, width, matchList.getRowHeight() );
        //Returns the object at the specified index.
        public Object get(ListField list, int index)
            return _listElements.elementAt(index);
        //Returns the first occurence of the given String, bbeginning the search at index,
        //and testing for equality using the equals method.
        public int indexOfList(ListField list, String p, int s)
            //return listElements.getSelectedIndex();
            return _listElements.indexOf(p, s);
        //Returns the screen width so the list uses the entire screen width.
        public int getPreferredWidth(ListField list)
            return Display.getWidth();
        //Adds a String element at the specified index.
        public void insert( String homeTeam, String awayTeam, int homeGoals, int awayGoals )
            MatchListRowManager row = new MatchListRowManager();
            Bitmap badge1 = Bitmap.getBitmapResource( homeTeam + ".png" );
            Bitmap badge2 = Bitmap.getBitmapResource( awayTeam + ".png" );
            row.add( new BitmapField( badge1 ) );
            row.add( new LabelField( homeTeam, LabelField.USE_ALL_WIDTH | LabelField.ELLIPSIS ));
            row.add( new LabelField( homeGoals + " - " + awayGoals, LabelField.USE_ALL_WIDTH | LabelField.ELLIPSIS | DrawStyle.HCENTER ));
            row.add( new LabelField( awayTeam, LabelField.USE_ALL_WIDTH | LabelField.ELLIPSIS | LabelField.RIGHT ));
            row.add( new BitmapField( badge2 ) );
            _listElements.addElement( row );
        //Erases all contents.
        public void erase()

    The manager used for individual fields of page layout that make up each listfield:

    public class MatchListRowManager extends Manager
        public MatchListRowManager()
            super( 0 );
        public void drawRow( Graphics g, int x, int y, int width, int height )
            layout( width, height );
            setPosition( x, y );
            g.pushRegion( getExtent() );
            subpaint( g );
        protected void sublayout(int width, int height )
            int preferredWidth = getPreferredWidth();
            //badge 1 field
            Field field = getField( 0 );
            layoutChild( field, 40, 40 );
            setPositionChild( field, 0, 5 );
            //home team field
            field = getField( 1 );
            layoutChild( field, ( preferredWidth - 160 ) / 2, 40 );
            setPositionChild( field, 42, 10 );
            //score field
            field = getField( 2 );
            layoutChild( field, 80, 40 );
            setPositionChild( field, 42 + ( preferredWidth - 164 ) / 2, 10 );
            //away team field
            field = getField( 3 );
            layoutChild( field, ( preferredWidth - 160 ) / 2, 40 );
            setPositionChild( field, 42 + 80 + ( preferredWidth - 164 ) / 2, 10 );
            //badge2 field
            field = getField( 4 );
            layoutChild( field, 42, 40 );
            setPositionChild( field, preferredWidth - 40, 5 );
            setExtent( preferredWidth, getPreferredHeight() );
        public int getPreferredWidth()
            return Display.getWidth();
        public int getPreferredHeight()
            return 50;

    I've tested this using the Bold 9700 Simulator with the API 5.0.

    I had a quick glance at some of the other posts about personalized listfields and have had no joy to find a solution so far. I would be grateful if someone could point me in the right direction here.

    I only have a few months of experience with Java programming, and very little experience developing for BlackBerry, so if there are no other pointers of how I could put this implementation, then that would be most appreciated.

    Thanks in advance!

    Suddenly appeared to me...

    Use this.getCallback () to get the instance of MatchListCallback and then replaced two calls super.paint (graph) with:

    callBack.drawListRow (this, graphics, startLine, xInds [0]);

    Problem solved.

    Thanks for the help, he led me on the right track!

  • I like the develop module, but I'm doing something wrong in the library in library, under 'Catalogue, all the photos', all my photos appear showing the stars, cropping, and development. The problem is that these changes are not for the photos on my hard d

    I love the develop module, but I'm doing something wrong in the library

    In the library, under 'Catalogue, all the photographs', all my photos appear showing the stars, cropping, and development. The problem is that these changes are not for the photos on my hard drive. When I re-import them in Lr, the changes are not there. My workflow is to do nothing after development or export them to the original with a new file name destination. Anyway, it is that they get a new file name without change of development when they are imported into Lr.  Please help (PC user)

    And others have explained, Lightroom does not apply the changes to the file. All changes are stored in the catalog, and then applied to the image when it is displayed in Lightroom. If you want a copy of the image with any changes so that you can share with others or send it to a laboratory to print, then you must export a copy of this image by using the export dialog box in Lightroom.

    Features of Lightroom as well by its design. The images that you import are always left in their original condition, unmodified.

  • Development/unfocus field custom button problem

    Hi all

    I have something weird happens.  I have a custom button field that swaps the images based on a focused state or blur.  I have been using this field custom for awhile now, and I have never had any problems.  Imagine the following provision:

    ______________    ________________________

    | Custom button |    | BasicEditField |

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

    When my screen is launched, the focus is on the custom button.  If I move the trackball in a downward movement, the focus is taken the custom button, and its background image changes adequately to what has been defined in the untargeted State.  The BasicEditField then has the focus.  This is the correct behavior.

    If, however, I move the trackball in a movement to the right to the BasicEditField, then the BasicEditField will indeed get the focus, however the custom button field always displays its "highlight" picture  Using print statements, I was able to determine that when I move in a movement to the right with the trackball, the custom field button loses the focus and then gets the focus back to back, that's why it shows the highlighted image.

    Additional info:  This isn't an issue on touch devices, and custom button Manager is a TableLayoutManager.

    Any ideas why this might be happening?  Here's the code to my custom button field:

    public class BitmapButtonField extends Field {
        private String text = "";
        private Bitmap bitmap;
        private Bitmap bitmapHighlight;
        private Bitmap b;
        private boolean highlighted;
        public BitmapButtonField(String image, String imageHighlight, long style) {
            super(style | Field.FOCUSABLE);
            this.bitmap = Bitmap.getBitmapResource(image);
            this.bitmapHighlight = Bitmap.getBitmapResource(imageHighlight);
            b = bitmap;
        public BitmapButtonField(String text, String image, String imageHighlight,
                long style) {
            super(style | Field.FOCUSABLE);
            this.text = text;
            this.bitmap = Bitmap.getBitmapResource(image);
            this.bitmapHighlight = Bitmap.getBitmapResource(imageHighlight);
            b = bitmap;
        protected void drawFocus(Graphics graphics, boolean on) {
            // Do nothing
        public int getPreferredHeight() {
            return bitmap.getHeight();
        public int getPreferredWidth() {
            return bitmap.getWidth();
        protected void layout(int width, int height) {
            setExtent(getPreferredWidth(), getPreferredHeight());
        protected boolean navigationClick(int status, int time) {
            return true;
        protected void onFocus(int direction) {
            b = bitmapHighlight;
        protected void onUnfocus() {
            b = bitmap;
        protected void paint(Graphics graphics) {
            int topTextPadding = (b.getHeight() - getFont().getHeight()) / 2;
            int sideTextPadding = (b.getWidth() - getFont().getAdvance(text)) / 2;
            graphics.drawBitmap(0, 0, getWidth(), getHeight(), b, 0, 0);
            if (text.length() > 0) {
                graphics.drawText(text, sideTextPadding, topTextPadding,
                        Graphics.ELLIPSIS, b.getWidth());

    Have you looked at navigationMovement in the TableLayoutManager?  I confess that I rewrote it because it handles no left and right as I wanted.  Perhaps, you might be able to do the same thing.

  • Add-on developer corner. Problem to add a screenshot to my module?

    At the corner of the developer for my module there is a problem adding a screenshot? I choose the topic of listentry change, add the png screenshot (it appears). Now when I click on save button changes there is no response, the server attempts to
    to always save the changes?

    The Addons support forum is here:

  • I started to develop some keyboard problem checked for all solutions could not.

    I started to develop checked for all the solutions found no keyboard problem. I realized that my net work is tahen above and my files diverted that I get these links of text by people representing miceosoft, promising new computer, employment and they reformatted my windows from vista to 7 and said that my reward .they have to my media my setings channged al and obtained the list of my contacts by sending them the meseges. Send me micro soft web pages which later changed in sofamicro. I'm afraid to use any String with soft micro logo on it .i ned help please, my our user at my items folders and emails al ben reset my key board break some keys and few of them do not work, the poster to the conection USB keyboard device manager there is corruption. Norton report ip who took the relay from my computer... I am the only user of this model as administrator, but the net work listed others that I can't remove, this AI out of this world, al tools that they could use to place these links and ask me click on a such that they were the ms Tech

    I do not understand some of your words.

    • 'stached"--> home?
    • "delwtwd"--> deleted?

    Assuming that I got those right, the answer is not much sense yet.  Take a deep breath, take your time and use simple language with common punctuation.  Type slowly.  Your hands are going faster than your mind and makes it hard to follow.  Don't make things worse by getting over excited.  ;-)

    What I tell you (based on the original post and now this response), this is your best course of action with your horribly hacked and infected system should all erase and start over - disconnecting the network while you do this to your computer.  If you have a USB and there are some select files/folders you want to have no EXECUTABLE in them - copy those turned off.

    You should probably reset each password you have for each account that you have as well – each of them.  Anywhere - Internet, etc.

    You may want to also likely reset everything router you might have that connect you to the Internet if there is a custom configuration - as they have probably your router pirate as well - giving them a back door at least in your network.

    What you have presented I can assume only you have been scammed.  They have probably used something like VNC or TeamViewer and your willingness to participate to take complete control of everything you have on your computer and possibly connected to your network.

    If it is a business network - disconnect your computer it immediately and contact your it Department and let them know what you think.

  • several checkbox in horizontalfieldmanager problem!

    Hi, I add several checkbox in horizontal fieldmanager.

    It displays as intended for os 5 and less but only displays the first box added to os 6.

    I don't know what the problem is! Please tell me what I'm doing wrong, or give me a work-around!


    check1 = new CheckboxField("1", true);
    check2 = new CheckboxField("2", true);
    check3 = new CheckboxField("3", true);
    checkField = new HorizontalFieldManager();

    Thanks in advance!

    It seems that in CheckboxField became "width-hungry" the OS 6.  Check this thread for the solution:

    CheckboxField, on the same line with OS6

  • Develop the screen problem

    On my screen to develop my picture looks like neon, I used a sort of filter/plugin. I must have hit a wrong button and I don't know how to cancel it so that my photo will look like what it really is.  I tried uninstalling and reinstalling but the problem is still there. Everything else seems to work. It's just the view to develop is turned off and I do not know how to reset. I have even a screen shot in work, but it doesn't seem like I can share it here. How can I reset this?  I have a screen shot, but it seems that I can't post it here. On my screen to develop my picture looks like neon, I used a sort of filter/plugin. I must have hit a wrong button and I don't know how to cancel it so that my photo will look like what it really is.  I tried uninstalling and reinstalling but the problem is still there. Everything else seems to work. It's just the view to develop is turned off and I do not know how to reset. I have even a screen shot in work, but it doesn't seem like I can share it here. I am a beginner.  Help, please?

    Post edited by: Rachel Bellenoit

    Go to the Lightroom preferences, performance tab, disable the GPU option. This is the usual solution for what you see.

  • Developer account name problem

    Hey, I would like to know why is the default name of my developer account different from my Apple ID because it has been created from this same Apple ID should some sort of confirmation from Apple to make it the same or I have to do something else? Thanks in advance!

    Hello StylianChairo,

    We are just other customers from Apple here. We cannot answer any question 'why' like that. If you create a developer account, then the name of this account will be your real name associated with your Apple ID. It will not be your real ID of Apple. You are not allowed to change it. If it is in fact wrong, then you can contact support at Apple developers and they should be able to fix it. Just be persistent.

  • HorizontalFieldManager problem

    I want to add fields to the horizontalFieldManager by defining their position as

    HorizontalFieldManager never respect the horizontal alignment - of course, because he has his own approach to horizontal placement. The best thing to do then import the JustifiedEvenlySpacedHorizontalFieldManager of

    Implement advanced buttons, fields and managers

    The code has a multitude of other great user interface code, so be sure to keep somewhere very practice.

    You can also experiment with setting the margins on your domains or creating fields of spacer and adding spacers Fluxsol between your gadgets actually used.

  • Custom HorizontalFieldManager problem focusable

    I had a VerticalFieldManager with a list of items.

    Each element is a HorizontalFieldManager custom, composed by other fields. These custom fields are FOCUSABLE by manufacturer.

    I would like to have the first element of the list selected/focused when I view my list of items.

    If I try to set focus on the first point of


    nothing seems to be happening: the debbugger says "FocusHistory: Focus acquired; App Tesssst; Component TestScreen.

    TestScreen is

    public class TestScreen extends MainScreen{
        BitmapField _placeholder;
        public TestScreen() {
            Background tiledBG = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("grey_tile.png"), Background.POSITION_X_LEFT, Background.POSITION_Y_TOP, Background.REPEAT_BOTH);
            HorizontalFieldManager horizontal = new HorizontalFieldManager(NO_HORIZONTAL_SCROLL|NO_HORIZONTAL_SCROLLBAR);
            CustomVerticalManager listVerticalContainer = new CustomVerticalManager(VERTICAL_SCROLL|NO_VERTICAL_SCROLLBAR);
            for(int i=0; i<19; i++){
                _placeholder = new BitmapField(Bitmap.getBitmapResource("imageplaceholder.png"));
                HorizontalItemField item = new HorizontalItemField(_placeholder, "ASD", "sukapub", 2, "100$", FOCUSABLE);
                if(i == 0) item.setFocus();
            System.out.println("@#@#@# FOCUSED ITEM = "+getFieldWithFocus());

    This one:

    System.out.println("@#@#@# FOCUSED ITEM = "+getFieldWithFocus());


    @# @ #@ # AXÉ ITEM = null

    Firstly, FOCUSABLE is supposed on connectors and downloaders - only fields.  If a manager has any focusable inside fields, its setFocus() will find the first such focus area and set to it. Compare the getFieldWithFocus() and the getLeafFieldWithFocus() to see the difference. In all cases, make sure that your _itemDetails is created focusable.

    Second, I noticed that you do not add _name, _publisher _price to your manager. Your sublayout is not also remove those. I can only imagine you send these fields to be placed somewhere else or

    Thirdly, given that you override sublayout anyway, consider the extension Manager rather than HorizontalFieldManager.  You can also use setMargin _image and _itemDetails drop sublayout() in total.  Even if Field.setMargin was documented in OS 6.0, he works since pretty much forever (my guess is since 4.0.0 - version where XYEdges appeared).

    Fourth - onFocus and onUnfocus managers are odd to say, I wouldn't count on them. onUnfocus, in particular, is wrong even in areas - could not get called at all. Use FocusChangeListener to detect the focus moves. Just add 'implements FocusChangeListener' to your class definition, implement ' public Sub focusChanged (field field, int eventType) and invoke setChangeListener (this) somewhere in the constructor. Respond to the types of FOCUS_LOST and FOCUS_GAINED events inside focusChanged and buttonColor and textColor changes - and don't forget invalidate()!

  • is there a solution for windows 7 to avoid the development of fly problems that some background running applications steal focus from current windows.

    To reproduce the accent fly you can follow these steps:
    1. go to the following link and click on 'Try' (or after clicking on 'try' to minimize the browser)
    2. before the popup is displayed in the above page switch to another application like notepad and start typing.

    3. when the popup is displayed in the #1 your keyboard focus should remain in Notepad.

    We have other applications that are stealing the focus from ongoing work and the creation of this disturbance.

    Could you please let us know if there is no solution or work around for this problem.

    Thank you


    Hi Subhash,

    Thanks again for your response.

    As you mentioned that this computer belongs to a domain, the question will be better suited to the audience of it professionals on the TechNet forums.

    I would recommend posting your query in the TechNet Forums.
    TechNet Forum

    Thank you

  • Develop the module problem after upgrade to LR6

    I upgraded from LR4.4 to 6, but had made a stop at 5.7 on the way. I have improved the catalog to v5.  Now in LR6, that I bought at the end of the day, photos in the develop module are corrupt. I can see them but are mainly grey with a few colourful highlights. Don't know if it's a question of catalog or how to fix. All files seem to be affected!

    Hi cruizemissile,

    Please turn off the graphics processor in the Lightroom preferences.

    Open Lightroom

    Go to Lightroom preferences in the Edit menu

    Click the performance tab

    Deselect the graphics processor

    Restart Lightroom

    Let us know if that helps.

    Kind regards


  • Development of Lightroom problem

    I tried to import photos into lightroom today and they look fine in the library.  When I open to develop the module, they are very strange looking.  They were photographs of the Moon last night.  When I opened to develop the module, the dark sky is a very bright blue pixelated.  I can open the files perfectly in photoshop and edit.  When I try to import photoshop files edited in lightroom, they are still wonky looking.  What can I do? It is a screenshot of the photo in the develop module.  Thank you very much for your help!Screenshot (23).png

    In the Panel histogram (top right of your screen), uncheck the clipping triangle shadow in the upper left corner of the Panel.

  • ADF Application - Development Mode deployment problem

    Hi Experts,

    I have jdev11. in combination with weblogic 10.3.5.

    my application works fine, while running on integrated wls (just give a click right and on my page jspx - auto deployment).

    If I go with manual deployment of option on same wls integrated or stand-alone wls means

    I can able to get my login page, if I have some means of connection he did re - direct to my index page than it would be problem? (it doent replicate this kind of integrated wls (auto deployment))

    Details of my Application
    use all adf security. my login page is in extended session bean index page - backing bean of limited scope.

    My diary shows, your user name and password is correct. This means that it can have access to my Module of the Application.

    use adfc - config to redirect
    <control-flow-rule id="__5">
        <from-activity-id id="__6">loginPage</from-activity-id>
        <control-flow-case id="__7">
          <from-outcome id="__13">error</from-outcome>
          <to-activity-id id="__8">loginPage</to-activity-id>
        <control-flow-case id="__14">
          <from-outcome id="__16">success</from-outcome>
          <to-activity-id id="__15">Indexpage</to-activity-id>
    This project does not behave like this days Olden.

    I scored on the sample for deplying a standlone wls and wls adf application built-in. It is very good.

    can anyone guide me where am?

    one has an idea?

    so am manual deployment I had dialogue "deployment configuration" to deploy.

    I got this in my journal.
    [01:07:44 PM] Entering Oracle Deployment Plan Editor
    [01:07:46 PM] No metadata repositories found on target server. Using values found in adf-config.xml. //show this red collor

    User707, can you on which you deploy the application? It is a stand-alone server or server that comes with jdev?
    Question: can you post the url that you use to launch the application on the server? The url contains ".jspx" as part of it?
    If Yes, try to remove the ".jspx" out of the url.


Maybe you are looking for