KeywordFilterField

Hello everyone.

I am writing my first Blackberry App and I was wondering if someone could help me with a problem I encounter.

My application consists of a list of objects on a screen using KeywordFilterField (a bit like address book App). I can list, search and display elements very well.

My question is this. I want to give the user an option to add and remove items from the list. And when it's done, I want to save the contents of the list to the 'base '.

How can I go about it? How to save the contents of the KeywordFilterField to "database"?

Thank you for your time.

Use the KeyWordFilterField.getResultList () method to get the list of items that are not currently filtered.

Tags: BlackBerry Developers

Similar Questions

  • Background color for the KeywordFilterField demo

    How to change the background color of the demo of KeywordFilterField

    You can override the paint of the KeywordFilterField method and use the code found here:

    How - to change the background color of a form
    Article number: DB-00131

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

  • Filter KeywordFilterField customized for the tabular data model

    I am currently looking for the rows in the table that is filtered through the KeywordFilterField. The underlying data are in table form:

    Contact {name, phone, etc etc}

    The KeywordFilterField shows only what I pass to it (Contact.Name) by calling setSourceList() and filters that the channels in the list. So if I get the numbers, which will return a list empty, because none of the Contacts have numbers in their names.

    However, what I want to do is query the table, like a SQL query, retrieve lines that correspond to a part of Contact.Name or Contact.Phone. (Remember this application don't use SQLite.) I'm using RMS to persistent storage and I created my database and queries of base by hand.)

    Is there a way I could customize/override the filter query so that the KeywordFilterField calls my query functions rather than it's default filter String? It is a base with search CRUD application. I use KeywordFilterField because it's everything I need.

    Any help would be useful.

    It is possible with a text field and a list field, this way you can make your own personalized search for the keyword filter field does not search your data the way you want. In addition, I know that the keyword filter field is broken and that it was returning always completely incorrect search result for me.

    Here's an overview of what to do. Some things I can't tell you how for example to what is happening in the function "searchContacts" since it is up to you to write the code to do whatever custom search you want.

    class CustomKeywordFilterScreen extends MainScreen implements FieldChangeListener, ListFieldCallback
    {
        //just a slightly modified edit field for use in entering keywords
        private CustomKeywordField _filterEdit;
        //a standard list field
        private ListField _countryList;
    
        //temp variable to hold the last keyword searched so we don't search for it again
        //you'll see this used later on
        private String _previousFilterValue;
    
        //any other private vars you need to hold search results go here
        //we'll use an a Contact[] for illustration
        private Contact[] _contactResults;
    
        CustomKeywordFilterScreen()
        {
            super(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR);
    
            //initiaize to empty string
            _previousFilterValue = "";
    
            //searchContacts is whatever function you write to do the customized search you want,
        //in this example passing an empty string returns all contacts
            _contactResults = searchContacts(_previousFilterValue);
    
            //create the edit field and set it as the title of the screen so it's always visible,
        //even when you scroll the list
            _filterEdit = new CustomKeywordField();
            _filterEdit.setLabel("Search: ");
            _filterEdit.setChangeListener(this);
            setTitle(_filterEdit);
    
            //create the list for showing results
            _contactList = new ListField();
            _countryList.setRowHeight(-2);
            _contactList.setSize(_contactResults.length);
            _contactList.setCallback(this);
            add(_contactList);
        }
    
        protected boolean keyChar(char c, int status, int time)
        {
            if (c == Characters.ESCAPE)
            {
            //user pressed escape key, if there's something in the edit field clear it
            //otherwise handle it as closing the screen or whatever else you want
                if (_filterEdit.getTextLength() > 0)
                {
                    _filterEdit.setText("");
                }
                else
                {
                    //close the screen or do something else, it's your call
                    //maybe even do nothing, whatever you want
                }
                return (true);
            }
            else
            {
            //all other keystrokes set focus on the edit field
                _filterEdit.setFocus();
            }
            return (super.keyChar(c, status, time));
        }
    
        public void fieldChanged(Field field, int context)
        {
            if (field == _filterEdit)
            {
            //test the edit field's value against the previously searched value
            //if NOT the same then do a search and refresh results
                if (!_filterEdit.getText().equals(_previousFilterValue))
                {
                //cache the newest search keyword string
                    _previousFilterValue = _filterEdit.getText();
    
                    //search your data
                    _contactResults = searchContacts(_previousFilterValue);
            //update the list size to cause it to redraw
                    _contactList.setSize(_contactResults.length);
                }
            }
        }
    
        public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width)
        {
            if (listField == _contactList && index > -1 && index < _contactResults.length)
            {
                //draw your list field row as you want it to appear
            }
        }
    
        public Object get(ListField listField, int index)
        {
            if (listField == _contactList && index > -1 && index < _contactResults.length)
            {
                return (_contactResults[index]);
            }
            return (null);
        }
    
        public int getPreferredWidth(ListField listField)
        {
            return (Display.getWidth());
        }
    
        public int indexOfList(ListField listField, String prefix, int start)
        {
            return (-1);
        }
    }
    
    class CustomKeywordField extends EditField
    {
        CustomKeywordField()
        {
            super(USE_ALL_WIDTH | NO_LEARNING | NO_NEWLINE);
        }
    
        protected void paint(Graphics graphics)
        {
            super.paint(graphics);
    
            //Draw caret so the edit field always shows a cursor giving the user an indication they can type at anytime,
        //even when the focus is on the list field that is used in conjunction with this edit field to create a
        //keyword filter field replacement
            getFocusRect(new XYRect());
            drawFocus(graphics, true);
        }
    }
    
  • Refresh a screen with a KeywordFilterField

    How can I get the screen to refresh after deleting an entry in a KeywordFilterField?

    If I close the screen and then re-open it, it seems OK, but I want the screen to refresh as soon as the entry is deleted.

    If it were a ListField, I could call setSize and setCallback, but those who do not exist for a KeywordFilterField.

    I also tried invalid, but it does not work either.

    Thank you...

    For all who are iterested, the trick was explicitly to remove the entry from the list filtered using:

    Object selectedEntry = _keywordFilterField.getSelectedElement ();
    _filteredList.elementRemoved (_list, selectedEntry);
    _list. Remove (selectedEntry);

  • How to display KeywordFilterField getResultListSize()

    Hello Experts...

    I have a KeywordFilterField and I would like to see the number of entries in the list of fitered in the title screen, but I can't seem to find a way to get the current number of items in the filtered list as soon as you press each key.

    I know that getResultListSize() can tell me the exact number, but how do I update on the title screen to each press of button?

    I tried the keyChar() substitution, but the number of items before button, not the new number of elements.

    Thank you

    Finally, I figured this out and thought I'd post the solution for other benefits.

    I had to put the following to my KeywordFilterField:

    _keywordFilterField.setChangeListener (this);

    This allowed me to catch the change of field and update the value.

  • R Keywordfilterfield.

    Hi guys,.

    I'm kinda stuck with it. Any help would be appreciated.

    What is the best way to refresh a Keywordfilterfield?

    Thank you.

    Thanks for the reply BB - dude.

    In fact, I wanted to refresh the content of the Keywordfilterfield.

    I got it to work in case anyone is interested.

    //add,remove of sourceVector.update elements)

    loadFrom (sourceVector.elements ());

    updateList();

  • KeywordFilterField lose hilight update on the device

    Seeing this behavior only on BlackBerry devices, but not on the Simulator.  I have the list of filters implemented using KeywordFilterField.  When you type in the filter string, obviously updates the filtered list, but when no corresponding elements remain and "* void *"item is displayed, it sometimes loses the culmination of development (by default blue background). "  This only happens on the physical devices, but not on the simulators (tried different models).  Once the highest point of focus has gone, it does not return until the application is restarted.  It is not loses focus since I can still scroll around the list, so it must relate to the update somehow not properly defined highlight color after that that he lost.

    Someone else met this problem and what is the possible cause and solution, as appropriate.

    I build 4. 7 x of targeting.

    This indicates that the application attempted to reference an invalid entry in a table or a vector value.  I think that validates your theory.

  • KeywordFilterField, how to remove the default label?

    I want to use KeywordFilterField in v6 and v5 for a filtered search field.

    So I created a:

    Kff KeywordFilterField = new KeywordFilterField();

    mKeywordField = kff.getKeywordField ();

    So far so good and mKeywordField stood a TextField with label default "search: The focus is at the end of "search:

    The problem is that if I start typing a search word, "search for:" doesn't go away. I "find: my typing something.

    In the contact of BB application, the behavior is different: when I type something, "search for:" disappears and the focus moves at the beginning of the text box.

    What should I do to get the same behavior as BB app contact?

    Thank you.

    I fixed this problem by adding the following code:

    If (keyword.length () > 0)

    {

    mKeyFField.setLabel("");

    } ElseIf (mKeyFField.getLabel () .length () == 0)

    {

    mKeyFField.setLabel ("Search");

    }

  • customize the display of the Keywordfilterfield listview

    Hello world

    I am developing a search application where should I look for in a list that has the details of countryname, capital of the country and the population of the country. I saw the demo of KeywordFilterfield in samples of JDE4.7 which is exactly like that.

    When you start typing in the filter field, seeking the names of countries, possible country names are given below, now what I want, I want to show that, in the same list I want to see the capital of the country and populationwith a different allignment.  But the search item must be the name of the country itself. Can someone help me...?

    In brief

    in jde list is in the form of China

    India

    United States

    What I want is that China

    Beijing 1322413000

    India

    New Delhi 1131043000

    Unites States

    Washington, D.C.         303545000

    How to customize this list?... If I put drawlistrow implemented to achieve this, it does not show the list at all... it is to show the * empty *... Please give suggestions if possible some code... Thank you

    I solved this issues. If someone has to face the same problem then use the links below to solve the problem.

    http://supportforums.BlackBerry.com/T5/Java-development/setRowHeight-dramaticly-slows-down-performan...

    http://supportforums.BlackBerry.com/T5/Java-development/KeywordFilterField-with-ListFieldCallback/m-...

    These links are very useful for understanding and personalization of the keywordfilterField...

  • Remove the prefix search on KeywordFilterField

    Hi all

    I have a KeywordFilterField and when the field is in focus and the user types on the keyboard, the field automatically search through the list using the keyboard input. I would just turn off.

    I tried invoking setSearchable (false), does not work.

    I tried the substitution of keyChar, my method of substitution are not even invoked.

    Can someone help me?

    Found a hack solution to this problem. If you create a custom TextField (Field.READ_ONLY) and set as its keyword filter field, now the prefix, the search stops and it triggers keyChar new event.

  • How to remove the spell check dialog box in a KeywordFilterField

    I want to create a search screen based on a KeywordFilterField.  I am modeling my solution based on the example of Blackberry KeywordFilterDemo.  In this example, they create a CustomKeywordField to enter the search string.  In my application, I'm typing I get a spellchecker any which is a dropdown menu that that obscures my TextField and I want to disable this, but have failed at this point.  The field that I use for research has the following constructor:

    static class final CustomKeywordField extends BasicEditField {}
    {CustomKeywordField()}
    Super(USE_ALL_WIDTH |) NON_FOCUSABLE | NO_LEARNING | NO_NEWLINE | NON_SPELLCHECKABLE);
    setLabel ("search :");
    }
            
    I added the NON_SPELLCHECKABLE flag in an attempt to remove from the dialog box that appears.  Does anyone know how to disable this?

    Found an old post which suggests to use NO_COMPLEX_INPUT to disable.

  • KeywordFilterField inside scrolling vfm


    A wild guess would be the following - your scrolling VFM is created without USE_ALL_HEIGHT, and when the field shrinks enough, it sets its own measure to use the height of this area.  From any area (and the Manager is a field) can only shoot in its area of action, he draws the background behind the lines currently displayed.

    Opinion - USE_ALL_HEIGHT is dangerous if you add your money to a default screen.  I know that you read one of my posts that suggested by the way NO_VERTICAL_SCROLL Ecran Builder - your case is a perfect example why.

    So, to summarize:

    (1) create a new MainScreen (MainScreen.NO_VERTICAL_SCROLL)

    (2) create new VerticalFieldManager(Manager.VERTICAL_SCROLL |) Manager.VERTICAL_SCROLLBAR | Manager. ( USE_ALL_HEIGHT)

    (3) your VOR if setBackground the target of 4.6 + phones; Override paintBackground() to the optimization of resources otherwise (explained in more detail in the knowledge base article - use a background picture in the screens of the application; if you override paint/paintBackground, make sure you read the comment here)

    (4) add your VFM to your screen

    (5) add your KeywordFilterField to your value for money.

    Good luck!

  • Problem in the customization of KeywordFilterField...

    Hi all

    Have KeywordFilterField custom execution problems.

    In ListField, fill us as below

    myList.insert (lstIndex);
    myCallback.insert(dataElement[lstIndex],lstIndex);

    lstIndex ++;

    and in the ListCallback class that implements ListFieldCallback, we read the vector

    ......

    String data = (String) listElements.elementAt (index); and the data would be used

    In the case of KeywordFilterField, we have

    _keywordFilterField.setSourceList (_dataList, _dataList);...

    _keywordFilterField.setCallback (lstCallBack);

    and class of ListCallback, I use drawListRow() to draw the custom user interface. Here, I'm not able to get the data (as thr is no insertion happening on the vector), can someone tell me how I can get the data, as I draw two lines (one)?

    Thank you and best regards,

    Raghav.

    I think that RAM had these two things in mind:

    (1) he would like to do a field filter that will filter the elements of list field. (something like BB phone app, you just start typing and the items listed include only words filtered - surname, name, etc.)

    (2) while filtering it would insert some rows matching the filter (I guess it of a y, as a better approach would be to list everything and then use 1) to remove the unnecessary lines after filtering).

    This is similar to the phone (again) BB app. When you focus on a contact address book name, another field (with the number) is inserted after the current emphasis is shifed to this topic.

    So in short:

    (1) how can we do a filter for a list field field?

    (2) how to dynamically add a line of list field?

  • BlackBerry: Improved interface user KeywordFilterField search


    I do not use this area because I wrote a similar field a long time ago that I use instead.  After reviewing the field however, the principles are the same - a search field entry and a ListField which displays the corresponding arguments.  So I think you can use the same approach I use in my own equivalent field.

    Assuming that you have a screen, then put an EditField in your title area or a banner

    setTitle (...)

    or

    setBanner (...)

    Add the KeywordFilter field to the normal part of the screen scrolling.

    Then use setKeywordField to use the field that you put in the title/banner as the entry in the filter area.  This means that the keyword will stay on top, while the scrolling of the list of filter.

    If you need more complex where the filter field went to the bottom of the screen, we can work similar magic but it is a bit more complicated.

    You might find follows her useful if you're not familiar with the screen.

    http://supportforums.BlackBerry.com/T5/Java-development/MainScreen-explained/Ta-p/606644

  • First line of KeywordFilterField error

    I have a KeyworkFilterField with a simple reminder that uses drawListRow to create a list of 2 lines.

    When the screen initially loading the first line there is only one line. After a search with any character of 2nd line shows. This only happens for the first row.

    With the help of jde 4.6.1.

    {public drawListRow Sub (ListField listField, graphics graphics, int index, int y, int width)}
    MYLIST = myFilterField.getResultList ();
    listField.setRowHeight ((graphics.getFont () .getHeight () * 2) + 0);
    Object currentRow = myList.getAt (index);
    If (null! = currentRow) {}
    graphics.setColor (Color.BLACK);
    graphics.drawRect (0, y, width, listField.getHeight ());
    graphics.drawText (((Device) currentRow) m:System.NET.SocketAddress.ToString (), 2, y);
    graphics.setColor (Color.LIGHTGREY);
    graphics.drawText (((Device) currentRow) .getFormattedPhone (), 2, (y + graphics.getFont () .getHeight ()));
    Draw the separation line.
    graphics.drawLine (0, y + listField.getRowHeight () - 1, listField.getPreferredWidth () + 1000, y + listField.getRowHeight () - 1);
    }

    You can retrieve fonts using getFont() (this.getFont () or myField.getFont ()).

Maybe you are looking for

  • Even if Adobe is assumed to be the default for downloads are always Firefox

    My computer crashed and after reinstalling Firefox on a new drive, I have problems.(1) even if I have it configured to use Adobe for PDFs and to always turn it on, it is still downloading pdf files and marking them as Firefox. Here are the pdf files

  • Portege M100 damaged Bios

    Hello yesterday, I turned off my M100 in now the switch as he begins. Given that the power light flashes orange when I turn it on and nothing else happens.I read that this means that the BIOS is damaged. Is there a way to fix this or is it really the

  • Satellite X 200-line appear on the screen and the computer to stop responding W7

    Hello I installed windows 7 a few days ago. I have download all the drivers, but: After starting the computer and connecting to windows, if I run an application too quickly (perhaps outlook, google chrome, internet explore explore...), it seems that

  • HP LaserJet 8500 a: printer8500A question

    You have a problem with my HP 8500.  Has got very slow or most of the time not printing at all.  Get the message to align the print head and did and still see her fail to align with it.   and continue to test every time print but no impression of the

  • How do I instantaite a C++ in Teststand object?

    Hello everyone, I would like to know if it is possible to instantiate a C++ object and use its methods in teststand. I searched in the examples and all the DLLs were developed as a normal dll (no object). I know it's possible in c#, but I have not fo