FOCUS ON THE CUSTOM LIST

I created a CustomListManger of extemding VerticalFieldManager. for lines, I created a CustomRow Manager by extending Mnager.

When I display the list, I am not able to focus on the CustomRowManager I added. Focusable property is enabled for the CustomRowManager and the CustomListManger.

Any help is welcome!

I used the thread below to solve the solution:

http://supportforums.BlackBerry.com/T5/Java-development/help-focus-on-managers/TD-p/1240859

Tags: BlackBerry Developers

Similar Questions

  • view the json data in the custom list field

    Hi, I did analysis json and I created the custom list field. Now, I want to display only the data analyzed in my custom list field. I'll post my analyzed data from json and here is the code for my custom list field
    data analyzed.
    I have THREE channels of json and I want to show content tittle and date in the list filed. I'll post the screenshot of my list.

    JSONArray jsnarry = new JSONArray(responce);
                System.out.println("\n--length----- "+jsnarry.length());
                //System.out.println("....................................................=");
                for (int i = 0; i < jsnarry.length(); i++){
    
                    JSONArray inerarray = jsnarry.getJSONArray(i);
                        //System.out.println("\n-inerarray-values----- "+inerarray.getString(i1));
                        String TITTLE = inerarray.getString(1);
                        String CONTENT = inerarray.getString(2);
                        String DATE = inerarray.getString(3);
                                                           System.out.println("TITTLE= "+TITTLE);
                        System.out.println("CONTENT= "+CONTENT);
                        System.out.println("DATE= "+DATE);
    
    }
    

    output

    [0.0] --length----- 2
    [0.0]
    [0.0] -innerarray-length----- 6
    
    [0.0] TITTLE= BJP State President Sanjay Tandon's visit to Amita Shukla's Home
    [0.0] CONTENT=  BJP President Chandigarh Sanjay Tandon at Amita Shukla's Home
    [0.0] DATE= 2013-01-04
    [0.0] ................................................
    [0.0] TITTLE= Sanjay Tandon at mahasamadhi of Satya Shri Sai baba.
    [0.0] CONTENT= BJP Chandigarh President, Sanjay Tandon mahasmadhi of Sri Satya Sai Baba.(Andhra Pradesh)
    [0.0] DATE= 2013-01-13
    

    and my custom list field

           super(NO_VERTICAL_SCROLL);
    
             String TITTLE="TITTLE";
             String CONTENT = "CONTENT";
             String DATE = "DATE";
    
             v.addElement(new ListRander(listThumb, TITTLE, CONTENT,DATE, navBar));
    
             myListView = new CustomListField(v){
    
                 protected boolean navigationClick(int status, int time) {
                     //Dialog.alert(" time in milisec :" + time);
                     return true;
                 }
             };
    

    CustomListField.java

    public class CustomListField extends ListField implements ListFieldCallback {
    
        private Vector _listData;
        private int _MAX_ROW_HEIGHT = 100;
    
        public CustomListField (Vector data) {
    
            _listData = data;
            setSize(_listData.size());
            setSearchable(true);
            setCallback(this);
            setRowHeight(_MAX_ROW_HEIGHT);
    
        }
    
        public int moveFocus (int amount, int status, int time) {
    
            this.invalidate(this.getSelectedIndex());
            return super.moveFocus(amount, status, time);
    
        }
    
        public void onFocus (int direction) {
    
            super.onFocus(direction);
    
        }
    
        protected void onUnFocus () {
    
            this.invalidate(this.getSelectedIndex());
    
        }
    
        public void refresh () {
    
            this.getManager().invalidate();
    
        }
    
        public void drawListRow (ListField listField, Graphics graphics, int index, int y, int w) {
    
            ListRander listRander = (ListRander)_listData.elementAt(index);
            graphics.setGlobalAlpha(255);
            graphics.setFont(Font.getDefault().getFontFamily().getFont(Font.PLAIN, 24));
            final int margin =5;
    
            final Bitmap thumb= listRander.getListThumb();
            final String listHeading = listRander.getListTitle();
            final String listDesc= listRander.getListDesc();
            final String listDesc2= listRander.getListDesc2();
            final Bitmap nevBar = listRander.getNavBar();
    
            //list border
            graphics.setColor(Color.BLACK);
            graphics.drawRect(0, y, w, _MAX_ROW_HEIGHT);
    
            graphics.drawBitmap(margin, y+margin+10, thumb.getWidth(), thumb.getHeight(), thumb, 0, 0);
    
            graphics.drawText(listHeading, 3*margin+thumb.getWidth(), y+margin);
            graphics.setColor(Color.BLACK);
    
            graphics.drawText(listDesc, 3*margin+thumb.getWidth(), y+ margin+30);
            graphics.drawText(listDesc2, 3*margin+thumb.getWidth(), y+ margin+60);
    
        }
    
        public Object get(ListField listField, int index) {
    
            String rowString = (String) _listData.elementAt(index);
            return rowString;
    
        }
    
        public int indexOfList (ListField listField, String prefix, int start) {
    
            for (Enumeration e = _listData.elements(); e.hasMoreElements(); ) {
    
                String rowString = (String) e.nextElement();
                if (rowString.startsWith(prefix)) {
    
                    return _listData.indexOf(rowString);
    
                }
    
            }
    
            return 0;
    
        }
    
        public int getPreferredWidth(ListField listField) {
    
            return 3 * listField.getRowHeight();
    
        }
    
    }
    

    Listrander.Java

    public class ListRander {}

    private bitmap listThumb = null;
    incognito bar Bitmap = null;
    private String listTitle = null;
    private String listDesc = null;
    private String listDesc2 = null;

    public ListRander (Bitmap listThumb, String listTitle, String listDesc, String listDesc2, Bitmap navBar) {}
    this.listDesc = listDesc;
    this.listDesc2 = listDesc2;
    this.listThumb = listThumb;
    this.listTitle = listTitle;
    this.navBar = bar navigation;
    }
    public getListThumb() {Bitmap image
    Return listThumb;
    }
    {} public void setListThumb (listThumb Bitmap)
    this.listThumb = listThumb;
    }
    public getNavBar() {Bitmap image
    return the navigation bar;
    }
    {} public void setNavBar (navigation bar of the Bitmap)
    this.navBar = bar navigation;
    }
    public String getListTitle() {}
    Return listTitle;
    }
    {} public void setListTitle (String listTitle)
    this.listTitle = listTitle;
    }
    public String getListDesc() {}
    Return listDesc;
    }
    {} public void setListDesc (String listDesc)
    this.listDesc = listDesc;
    }
    public String getListDesc2() {}
    Return listDesc2;
    }
    public void setListDesc2 (String listDesc2) {}
    this.listDesc2 = listDesc2;
    }
    }

    You seem to have two problems here and are confusing them.  You must break the problem into two parts

    (1) extract the data from the entry and create the objects you want to display

    2) display in a list, a set of objects.

    Let's get the sorted first premiera.

    I will suggest what to do here, but in practice, you might actually think about this yourself as part of the design phase of your application.  You should do this, not me, because then you will have all the information available.  At the present time, I have just what you said, which is not much.  So maybe what I'm telling you is not correct for your application.  Only you can decide that.  And be blunt here, you should have decided this before you start coding.  Do you want you could lead down the wrong path.  You must think of your application as a home - as the architect must design all the rooms, and how they will be built, before you start building the House.  You do not, then we are building the rooms on the fly.  Who knows if they will be fit at home?

    In this case, I think you need to create an object that represents each of the elements in the internal array of new data.  call this object

    NewsItem

    This object will have attributes, such as its title, content, date, the linked image and so on, each of whom have will get and set methods.  While you treat each inner element fetch you the associated entry and update the object.

    When you have finished the inner loop of processing, you now have a complete

    NewsItem

    Object, so you will add it to a collection, an array of NewsItem objects, call this _newsItems.  You will create it at the beginning - you know how many entries it takes because it is the number of entries in your outdoor table.

    So before you start to deal with JSON, create your table and the 'index' value of 0.

    Once you have created your Newsitem, add this in the table to the position 'index' and increment "index".

    And once you have analyzed all the JSON, you will have a complete picture.  This is part 1 finished!

    And note in your drawListRow, you are given a clue - that is the index in your tables in _newsItems.  So you can easily find which entry to view and display it correctly.  But it is part 2 and is a separate issue.

  • Cannot focus on the custom itemRenderer?

    I made a custom itemRenderer double as an itemEditor following the instructions in the documentation.
    However, even if I put the rendererIsEditor = "true", when tabbing between other editable fields, controls within the itemRenderer do not receive focus. I can't help thinking it of a control/bug, but is it possible to submeter the itemRenderer to focus properly? At the moment my component is simply a box inside an HBox.

    Anyway, here is my code so that you can see for yourself (I have included a checkbox as itemRenderer so that you can see the * desired * effect.)

    <? XML version = "1.0" encoding = "utf-8"? >
    < mx:Application
    ' xmlns:MX =' http://www.adobe.com/2006/mxml ' layout = "vertical" >
    < mx:Script >
    <! [CDATA]
    Import mx.controls.dataGridClasses.DataGridListData;
    Import mx.controls.Alert;
    [Bindable]
    public var dp:Array = [{num:2, bool:true}, {num:3, bool:false}];
    []] >
    < / mx:Script >
    < mx:DataGrid id = "test" editable = "true" dataProvider = "{dp}" >
    < mx:columns >

    < mx:DataGridColumn dataField = "num" headerText = "num" / >
    < mx:DataGridColumn dataField = "bool".
    headerText = "sent".
    itemRenderer = "mx.controls.CheckBox"
    rendererIsEditor = "true" editorDataField = "selected" / >

    < mx:DataGridColumn dataField = "num" headerText = "num" editable = "true" / >
    < mx:DataGridColumn dataField = "bool" headerText = "Sent" rendererIsEditor = "true" editorDataField = "blorch" >
    < mx:itemRenderer >
    < mx:Component >
    < mx:HBox horizontalAlign = "center" >
    < mx:Boolean id = "blorch" / >
    "< mx:CheckBox id = 'check' selected =" {data.bool} "change =" blorch = check.selected "/ >
    < / mx:HBox >
    < / mx:Component >
    < / mx:itemRenderer >
    < / mx:DataGridColumn >
    < mx:DataGridColumn dataField = "num" headerText = "num" editable = "true" / >
    < / mx:columns >
    < / mx:DataGrid >
    < / mx:Application >

    Too bad... I found the answer to a few pages later in the docs...
    You must implement the IFocusManagerComponent interface and then substitute drawFocus as below to set the focus to the checkbox... hope it works for multiple controls.



    override public function drawFocus(focused:Boolean):void {}
    check.setFocus ();
    }
    ]]>



  • Move the focus of the custom button

    Hello

    My button did to paint two differrent bitmap:

    Paint (Graphics g)

    {

    g.isDrawingStyleSet (Graphics.DRAWSTYLE_FOCUS)? FOCUS: NORMAL;

    g.drawBitmap (0, 0, getPreferredWidth(), getPreferredHeight(), _bitmaps [index], 0, 0);

    ...

    }

    How do I call it g.setDrawingStyleSet (Graphics.DRAWSTYLE_FOCUS, false) to navigationUnclick (State of the int, int hour). To make the button unfocus after a click.

    removeFocus() didn't work?

    clues will be a great help.

    This will work as long as the button is focused. You can add a custom boolean to change the drawing, or move the focus to another field.

  • How to manage the focus in the custom component

    Hallo. As you know some flex components have indigenous focus, like buttons, textinput, etc... I created a custom component which is a borderContainer... As you know, by default, if the user press TAB my BorderContainer will never receive the focus... I tryied to set a property as setFocus() and tabFobusEnabled to true, but I still have some problems with my borderContainer development... It's as if my app knows that my custom component is not a native component... Is there a way for my component to receive focus without problems?... Which is the best way to do this?

    Thx a lot

    Max

    Components must implement IFocusManagerComponent in order to receive the focus.

  • Clear link to the customer list

    Kind of goofy question - how can I clear the list of VC servers and hosts that your client is connected to?  On mine there is a bunch of connections unique to the guests, as well as tips from the lab that doesn't exist anymore - more than 40 points in total!

    I guess that's in a file on my PC, but I can't.

    I think that I found... It is in the registry

    Search for past connections.

  • Create focus on the custom edit field?

    There's my code to see the login screen...
    I want to create special border editfield when he onFocus? so people place now developed...

    public LoginScreen()
        {
            super( NO_VERTICAL_SCROLL | USE_ALL_HEIGHT | USE_ALL_WIDTH );
            this.getMainManager().setBackground(BackgroundFactory.createLinearGradientBackground(0x0099CCFF,
                    0x0099CCFF,0x009933FF,0x009933FF) );
    
            Bitmap logoEcc = Bitmap.getBitmapResource("ecc.png");           //call image
            BitmapField logo = new BitmapField(logoEcc,Field.FIELD_LEFT);               //make logo side left
            hfm = new HorizontalFieldManager(Field.USE_ALL_WIDTH)           //new horizontalmanager with All Width
            {
                protected void paint(Graphics graphics)
                {
                    graphics.setBackgroundColor(Color.BLACK);
                    graphics.clear();
                    super.paint(graphics);
                }
            };
            hfm.add(logo);
            add(hfm);
            add(new SeparatorField());
    
            username = new LabelField("Username", Field.FIELD_LEFT);
            add(username);
    
            usernameEdit = new EditField (Field.USE_ALL_WIDTH)
            {
                protected void paint(Graphics g)
                {
    
                XYEdges padding = new XYEdges(3, 3, 3, 3);
                int color = Color.BLACK;
                int lineStyle = Border.STYLE_SOLID;
                Border roundedBorder2 = BorderFactory.createRoundedBorder(padding, color, lineStyle);
                usernameEdit.setBorder(roundedBorder2);
            //  g.setBackgroundColor(Color.WHITESMOKE);
                g.clear();
                super.paint(g);
            }
            };
            add(usernameEdit);
    
            password = new LabelField("Password", Field.FIELD_LEFT);
            add(password);
    
            passwordEdit = new PasswordEditField ()
            {
                protected void paint(Graphics g)
                {
                    //g.setBackgroundColor(Color.WHITESMOKE);
                    g.clear();
                    super.paint(g);
                    XYEdges padding = new XYEdges(3, 3, 3, 3);
                    int color = Color.BLACK;
                    int lineStyle = Border.STYLE_SOLID;
                    Border roundedBorder2 = BorderFactory.createRoundedBorder(padding, color, lineStyle);
                    passwordEdit.setBorder(roundedBorder2);
                }
            };
            add(passwordEdit);
    
            add(new SeparatorField());
    
            login = new ButtonField("Login",Field.FIELD_HCENTER);
            login.setChangeListener(this);
            add(login);
    

    any solution? Thank you...

    Hello

    EditField ed = new EditField(){protected void drawFocus(Graphics f, boolean value)
    {              graphics.setColor(Color.BLUE);                 int width = getPreferredWidth();                 int height = getPreferredHeight();                 //Draw a border around the field.                 graphics.fillRect(0, 0, 3, height); //Left border                 graphics.fillRect(0, 0, width, 3); //Top border                 graphics.fillRect(width-3, 0, 3, height); //Right border                 graphics.fillRect(0, height-3, width, 3); //Bottom border
    
    }};
    
    
    

    Write like this...

  • Accessing the context property of main.qml to a custom list in a file item separate qml

    Hi all

    Sorry if this is already covered somewhere.

    I currently have an application with a list view in my main.qml.  I put a context property for my class app c ++ to be "app" in my main.qml.  My list uses a custom list item that is defined in a file separate qml.  The custom list item has a popup menu.  In this context menu, I want to call Q_INVOKABLE functions that are part of my class from the main application in C++.  What is the best way to be able to do?  Should I just set the context property on my file qml of list item custom like I do with my main.qml or is there a better way?

    Thank you

    I think that this has been repeated several times, but as it is not really intuitive:
    a listitemcomponent lies in a different context, it cannot access the context property of the qml file.
    You can use the reference to the listview to reach outside, see https://developer.blackberry.com/cascades/reference/bb__cascades__listview.html ListItem.view

  • The Custom Format recording

    Hi all

    I'm looking how to save a document in a custom format.

    When registering a .tga I use:

    PSapp.ActiveDocument.SaveAs (output, tgaSaveOptions, psExtensionType.psLowercase, false);

    What I want is to save in a customized format that is not in the list of available SaveOptions.

    The format I want to save is a specific .tga: NW4C_TGA (file owner format) there several options specific to the economy of this format.

    When I save a file by hand in the display save as Photoshop dialog box, it displays the custom list format and I can select and configure the options.

    It's because I put the NW4C_Tga.8bi file in the directory of Plug-ins for photoshop.

    How can I access these custom by the script format?

    Thank you very much for your attention.

    Jeff

    You must install the plugin scriptlistner and see if it creates a code when you save in this format.

  • When I right click on the list box column Multi that I should get the custom options

    Hi all

    In my application, I want to display the custom user menu when it right-click on the Multi column list box. I want to know is - it possible to do like this. Please can someone help me on this?

    in abow picture I get "reset default value, cut, copy the data, past data" so I need to set other options.

    Kind regards

    Santhosh M

    Hi santosh,.

    This one is much better.

  • How to remove the focus from the field of the custom label

    Hello

    I have a question on the subject to focus on fields. I did a registration form and added a label + image and text box on a vertical field Manager. but when I scroll through image and text box get the focus and disappear from my label.
    I took the custom label field and the custom text box.
    Help, please...

    protected void drawFocus(Graphics graphics, boolean on){paint(graphics);}
    
  • How to determine if the rank of the acquired list focus?

    Hi all

    I have ListField with custom reminder.

    When the user change focus by the movement of the navigation, drawListRow() is called several times - for each focus-changed event.

    How can I determine in the method drawListRow() if current rank on the FOCUS_GAINED event?

    I can do that by following the path:

    public void focusChanged( Field field, int eventType )    {        mIsFocusGained = false;
    
            if( eventType == FOCUS_GAINED )        {            mIsFocusGained = true;        }    }
    
     public void drawListRow( ListField listField, Graphics graphics, int index, int y, int width )    {        int rowHeight = listField.getRowHeight();        int selectedIndex = getSelectedIndex();
    
            if( index == selectedIndex && mIsFocusGained )        {            drawHighlightRegion( graphics, HIGHLIGHT_FOCUS, true, 0, y, width, rowHeight );        }---------
    

    But I can do that directly in drawListRow()?

    Thank you

    I expected allows you to change your listener to update as follows:

    if ( eventType == FOCUS_GAINED )
    {
    mIsFocusGained = true;
    }
    else
    if ( eventType == FOCUS_LOST )
    {
    mIsFocusGained = false;
    }
    

    I think you should ignore FOCUS_CHANGED because the listField stil keep focus in these events.

    I'm not clear on what you mean by that:

    "is that a function is to determine/get current theme ceremony?

    I thought you did that with your FocusChange listener?

  • How to load the second list meter if I have something in the first list of select/focus?

    How to load the second list meter if I have something in the first list of select/focus?

    public class spintest extends BaseScreen implements {FocusChangeListener}

    final String [stateList] = {"New York", "Washington"};
    final String [] NYcities = {'Manhattan', 'Queens', 'Brooklyn', 'Bronx'};
    final String [] WashCities = {"Redmond", "Kent", "Seattle", "Bellevue"};

    public SpinTest() {}
    SpinBoxFieldManager spinBoxMgr = new SpinBoxFieldManager();

    SpinBoxField spinBoxStates = new TextSpinBoxField (stateList);
    spinBoxStates.setFocusListener (this);

    SpinBoxField spinBoxCities = new TextSpinBoxField (NYcities);

    spinBoxMgr.add (spinBoxStates);
    spinBoxMgr.add (spinBoxCities);

    Add (spinBoxMgr);
    }

    ' Public Sub focusChanged (field field, int context) {}
    If (spinBoxStates == field) {}
    Salt string = (String) spinBoxStates.get (spinBoxStates.getSelectedIndex ());
    If (sel.equals ("New York")) {}

    I have to load all the cities of New York in the second wheel if I select 'New York' in the first wheel

    }
    else {if (sel.equals ("Washington"))

    I have to load all the cities of Washington in the second wheel if I select 'Washington' in the first wheel

    }

    }

    Simply call the TextSpinBoxField.setChoices method, transmitting your new list of choices.

  • Handle to the line on custom list

    I use the code in this page to display a custom list. The problem I have now is I want to handle each line onFocus event in the list to change its background color. No idea how to do?

    Hello

    You encounter method DrawListRow that you define the color as below

     public void drawListRow(ListField listField, Graphics g, int index, int y,
                int width)
        {
            if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS))
            {
                g.setColor(Color.RED);
            } else
            {
                g.setColor(Color.BLUE);
            }
    // then draw rect
    
                    g.drawRect(0, y, width, 80);
    //draw text in list
                    g.drawText("Blackberry", 90, y + 9);
             }
    

    ----------------------------------------------------------
    feel free to press the congratulations on the left side to thank the user who has helped you.
    Please mark as resolved messages if you found a solution.

  • How long does it take for the custom field created in SFDC appears in the list of field mapping?

    How long does it take for the custom field created in SFDC appears in the list of field mapping? I hit the refresh field button, but it does not appear after 5 min. I just need to have patience?

    I had the same problem yesterday, I think it took about 10-15 minutes to appear.

Maybe you are looking for