ListField & searchable feature

Hello

I wrote a class for managing a ListField, but I can't view the searchField by using the function 'setSearchable '!

import java.util.Vector;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.system.*;

class ListDeviceField extends ListField implements ListFieldCallback {
    private Vector _lstDeviceName;

    private int lastDownX;
    private int lastDownY;

    public ListDeviceField() {
        super();

        setSearchable(true);
        setCallback(this);

        _lstDeviceName = new Vector();
    }

    public void addElement(final String s) {
        _lstDeviceName.addElement(s);

        setSize(_lstDeviceName.size());
    }

    protected boolean navigationClick(int status, int time) {
        if (isFocus())
            fieldChangeNotify(1);

        return true;
    }

    public boolean isFocus() {
        int posX;
        int posY;

        posX = getScreen().getContentLeft() + getContentLeft();
        posY = getScreen().getContentTop() + getContentTop();

        if ((lastDownX > posX) && (lastDownX < (posX + getWidth())))
            if ((lastDownY > posY) && (lastDownY < (posY + getHeight())))
                return true;

        return false;
    }

    public boolean touchEvent(TouchEvent te) {
        lastDownX = te.getGlobalX(1);
        lastDownY = te.getGlobalY(1);

        return super.touchEvent(te);
    }

    // ListFieldCallback API
    //-----------------------

    public void drawListRow(ListField list, Graphics graphics, int index, int y, int w) {
        if (index < _lstDeviceName.size()) {
            String s = (String) _lstDeviceName.elementAt(index);

            graphics.drawText(s, 0, y, 0, w);
        }
    }

    public Object get(ListField list, int index) {
        if (index < _lstDeviceName.size()) {
            return _lstDeviceName.elementAt(index);
        }

        return null;
    }

    public int getPreferredWidth(ListField list) {
        return Display.getWidth();
    }

    public int indexOfList(ListField list, String prefix, int start) {
        for (int i=start; i<_lstDeviceName.size(); i++) {
            String name = (String) _lstDeviceName.elementAt(i);

            if (name.startsWith(prefix))
                return i;
        }

        return -1;
    }

}

You will also notice that I've declared a new function isFocus... The default implementation returns always "wrong!"

I also changed the notification...

All work fine.

But I don't have the searchField, while I put: setSearchable (true)!

Kind regards

Nicolas

Hello

I don't think that a textField will appear with llistfield as you want. You must type characters and focus will change to this entry.

I think that rather than use ListField use KeywordFilterField.See the demo of it provided with the JDE.

Tags: BlackBerry Developers

Similar Questions

  • ListField setSearchable?

    How to set the listfield searchable. ? I tried Listfield.setSearchable but it force are reflected in the application.

    KeyPress not working is not in the list. How to reach the searchable when listfield keypress?

    The research is provided by the indexOfList() method.  If you want to implement research, you must implement this method and use it to your list of research that you need.  So to implement this method and debug to see what is happening on a button.

  • Future of the prelude

    I heard rumors about another site of social media with Speedgrade, prelude will be put on the back burner. Is it true Adobe? I use the prelude to connect and 'bookmark' my video with searchable content markers. This is very useful for the documentary style and shoots which take place in weeks. Please say it's not true and if it is... Please tell me you are going to integrate this easily created marker, searchable feature inside PR

    AJ

    Hi Alphawolfe,

    I've heard... Prelude will be put on the back burner. Is it true Adobe?

    I'm really sorry, but we announced no plans in that direction ahead. Sorry, it is the policy of the company. That said, we welcome all prelude requests for features at any time.

    Thank you
    Kevin

  • Field to focus on a searchable ListField through the Enter key

    Hi all

    I have one ordered (I use SimpleSortingVector) ListField that contains only strings, so I want to catch (alphanumeric) of essential production factors to target the first item in the list that begins with the Enter key.  I think this can be solved with the indexOf method or the indexOfList method and focus on this area, but don't know how to use both methods. How can I do this? or is there another way to do it please show it...

    Thanks in advanc

    It is actually very easy using indexOfList (.).

    First of all, if you call great or do not ignore it, I think that the treatment will do a "toString" on each getItem, so if the getItem returns the string, you may have to do nothing at all.  However, I found that the default implementation will just before, so I coded so that it will wrap.  The pseudo-code looks like

    for (int i = start + 1; I< listfield.size();="" i++="" )="">

    String testString = the ith index in the ListField

    If {(testStrinag.startsWith (prefix))

    Return i;

    }

    }

    for Int i = 0; I have< start;="" i++="" )="">

    String testString = the ith index in the ListField

    If {(testStrinag.startsWith (prefix))

    Return i;

    }

    }

    back to top; did not find, do not move.

  • Who's in the driver download &amp; complete software features for officejet pro8600, which is not in the database?

    Nobody knows what is in the driver full features & downloading the V28.8 software or for any version really another version of the case for Officejet pro8600... What's not in the download database?

    I'm running vista on an old computer and it doesn't have service Pack2 on it, which is necessary for the functionality of full download download.

    Just wondering if its worth the installation of service pack 2 to get the best features.

    See you soon

    Hello

    For Windows Vsita any service pack is supported and you are not required to install a service pack to install the full feature software, only Windows XP requires at least Service Pack 2...

    You can find the system requirements below:

    http://support.HP.com/us-en/document/c02858465

    The most important feature of the full feature software is Iris OCR reading that allows to scan to searchable PDF or editable text...

  • The printer software e-all-in-one-HP Deskjet 3520 includes scan-to-searchable PDF function?

    The printer software e-all-in-one-HP Deskjet 3520 includes scan-to-searchable PDF function? I installed the full version of the software, and this isn't a scan option, only standard PDF. If it is not included with the not on this model is an alternative HP printer software that would work with this printer and if not, is there an all HP designed for home or small office printers still have this feature?

    Hello

    Please visit the following link:

    http://h30434.www3.HP.com/T5/scanning-faxing-and-copying/does-the-HP-OfficeJet-4620-e-all-in-one-printer-software/m-p/2821615

    Kind regards.

  • The printer software e-all-in-one HP Officejet 4620 includes scan-to-searchable PDF function?

    The printer software e-all-in-one HP Officejet 4620 includes scan-to-searchable PDF function? If not, all printers HP still have this feature?

    Hello

    Please try the following alternative:

    http://www.PDFCore.com/p01_advancedpdfutilitiesfree/feature_09.html

    Kind regards.

  • HP Deskjet Ink Advantage 3545: 3545 HP how can I scan to searchable PDF?

    Las en AIO of HP Photosmart D110 printers are posible escanear documents a "buscables" PDF (searchable PDF) instalando el software ocr_web_pack. Como puedo hacer esto in una more HP Deskjet AIO 3545?

    Hello

    The HP Deskjet 3545 do not offer the features OCR searchable PDF is not a scan size available for the HP scanning software.

    Try 3rd party NAPS2 request, a freeware PDF application that also supports the scanning OCR (indexable PDF):

    http://www.naps2.com

    Kind regards

    Shlomi

  • Touch anywhere on the screen calls the ListField TouchEvent.DOWN

    Hello

    I suffer with small complex issue. In the screen of my application, I have the title bar with a labelfield and two custom buttons.

    Below the titlefield I add a list field.

    Now, I have a few complex features on the field from the list. When I click each line in the list, it should move to another screen I do using navigation, click medium. Now if I touch the rank in the list (for touch devices), it should move to another screen. And if I touch along the line of the list, it will display popup menu (custom, not by default) with option of removal and details.

            mListItem = new ListField(length, ButtonField.CONSUME_CLICK)
            {
                long touchedAt = -1;
                long HOLD_TIME = 500;
    
             // The regular getFieldAtLocation returns wrong values in open
                        // spaces in
                        // complex managers, so we override it
    //                  public int getFieldAtLocation(int x, int y) {
    //                      XYRect rect = new XYRect();
    //                      int index = getFieldCount() - 1;
    //                      while (index >= 0) {
    //                          getField(index).getExtent(rect);
    //                          if (rect.contains(x, y))
    //                              break;
    //                          --index;
    //                      }
    //                      return index;
    //                  }
                protected boolean navigationClick(int status, int time)
                {
                    // Click related functionality
                    return true;
                }
    
                protected boolean touchEvent(TouchEvent message)
                {
                    if(message.getEvent() == TouchEvent.DOWN)
                    {
                         if (getFieldAtLocation(message.getX(1), message.getY(1)) == -1)
                         {
                             Logger.out("AccountList", "Touch down: getField location");
                             return true; // kill the event
                         }
                         else
                         {
                             touchedAt = System.currentTimeMillis();
                             touchedonList = true;
                             Logger.out("AccountList", "Touch down: touched down  "+touchedonList);
                         }
                    }
                    else if(message.getEvent() == TouchEvent.UP )
                    {
    
                           if(System.currentTimeMillis() - touchedAt < HOLD_TIME && touchedonList == true)
                           {
                               touchedAt = -1; // reset
                               // Single Touch and Move to another screen
                           }
    
                           else if(touchedonList == true)
                           {
                             // Showing Menu Popup
                           }
                    }
                    return true;
    //              return super.touchEvent(message);  // Not using this as it will show the default pop up
                }
    

    And here's my reminder list field:

    public class ListCallBack implements ListFieldCallback
        {
            public void drawListRow(ListField listField, Graphics graphics, int index,
                    int y, int width) {
    
                String strdomOrg = yyyyyyy;
                String text = xxxxxx;
                Font f = FONT_FAMILY_0_SF_AS_08;
    
                int h = f.getHeight();
    //          int height = (listField.getRowHeight() - h)/2 ;
                int height = h/2 ;
                y += height;
                graphics.setFont(f);
                graphics.setColor(Color.BLACK);
                graphics.drawText(strdomOrg, 10, y, DrawStyle.ELLIPSIS, width);
                y = y + h;
                graphics.setFont(FONT_FAMILY_1_SF_AS_08);
                graphics.setColor(Color.BLACK);
                graphics.drawText(text, 10, y, DrawStyle.ELLIPSIS , width);
    
             // use the offset instead
                int offset = (listField.getRowHeight() ) >> 1;
                if (index != 0) {
                    graphics.drawLine(0, y - offset , width, y - offset);
                }
            }
    
            public Object get(ListField listField, int index) {
                // TODO Auto-generated method stub
                return mAccounts[index];
            }
    
            public int getPreferredWidth(ListField listField) {
                // TODO Auto-generated method stub
                return screenWidth;
            }
    
            public int getPreferredHeight() {
                return getContentHeight();
            }
    
            public int indexOfList(ListField listField, String prefix, int start) {
                // TODO Auto-generated method stub
                return listField.getSelectedIndex();
            }
    
        }
    

    Now the question is to come a different way:

    1. whenever I touch the buttons in title field, he calls the listfield TouchEvent.DOWN. Then the click of a button does not work. Instead, by clicking on the title bar, it moves to another screen, which is the feature click list filed.

    2. so I added the listfield at a value for money. :

    m_vfmScreen = new VerticalFieldManager(VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR)
            {
    
            protected boolean touchEvent(TouchEvent message) {
                    int event = message.getEvent();
                    if (event == TouchEvent.CLICK) {
                        if (getFieldAtLocation(message.getX(1), message.getY(1)) == -1)
                            return true; // kill the event
                        else {
                        }
                    }
                    return super.touchEvent(message);
                }
    
                // The regular getFieldAtLocation returns wrong values in open
                // spaces in
                // complex managers, so we override it
                public int getFieldAtLocation(int x, int y) {
                    XYRect rect = new XYRect();
                    int index = getFieldCount() - 1;
                    while (index >= 0) {
                        getField(index).getExtent(rect);
                        if (rect.contains(x, y))
                            break;
                        --index;
                    }
                    return index;
                }
            };
    

    While in the list key of field works. If I touch the buttons in the title bar, it does not. But if the keys become focus, this case they work.

    So I am in dilemma, what exactly the problem. Can someone please help.

    For me, there's a code unepxected in your touchEvent() - getFieldAtLocation().  If you want released supporess presses of field, I suggest you use code like this:

    protected boolean touchEvent (TouchEvent message) {}

    int x = message.getX (1);
    int y = message.getY (1);
    If (x < 0="" ||="" y=""> < 0="" ||="" x=""> getExtent () .width: y > getExtent () .height) {}
    Outside the scope
    Returns false;
    }

  • How to clear the ListField component

    I have a custom component ListField, who is quite simple - it is the feature primary method of painting. It uses ListFieldCallback callback = this.getCallback (); to get the data. But I have a problem with this table of compensation? the list (this class instance) has not all clear/clean/empty methods, what is the best way to delete it?

    Not sure that understand this issue.

    If you are you draining all the data so that no lines are displayed, you can use setSize (0);

    If you want to delete specific lines that could be displayed, the best thing to do in my opinion is delete the ListField of Manager and add a new.

    You can void lines in the ListField, but I don't know enough about your condition to understand if it will work for you.

    We often add/remove process when the data behind the ListField change - one of the great things about this control seems to be a very quick process.

  • ListField: setCallback is not necessary?

    OK, this surprised me. I've implemented a ListField subclass that implements ListFieldCallback. Due to an oversight, I forgot to add setCallback (this) in my subclass constructor. However, it works very well! The debugger shows that each instance is automatically entered as its object of ListFieldCallback.

    My question is: is this standard behavior for ListField or just undocumented feature that may or may not work with versions of OS? (I tested with 4.2.1, 4.6, 4.7 and 5.0 simulators).

    Yes, but it won't hurt to call setCallback to be sure, who will probably make your code easier to follow.

  • I'm Pro Member, but cannot "Improve scans" to make them searchable

    I've beaten my head against the wall trying to figure out how to use these features I didn't know that I was paying for.

    Before everything... the function "Improve Scans" that I would have access to. I'm scanning all kinds of bills and documents and had searched the Internet for a solution that would allow me to make the text searchable and low and here's... Adobe Acrobat Pro DC subscription has this feature... I had a subscription forever.

    When I followed the tutorial Adobe offers... I come to 'Strengthening the Scans' icon and it says below 'Add '.  Whenever I click on the Add button, need me a screen that said I have this subscription/account service and must create a new account if I want to add to another subscription. I am connected through Adobe Acrobat Reader DC... What am I doing wrong?

    Thanks in advance!

    I think you can make a common mistake. Please start Acrobat and look in the Help menu. He'll say one of these

    On Acrobat Pro

    On Acrobat Standard

    On Acrobat Reader

    On Adobe Reader

    (There is no 'Reader Pro', it's one or the other)

  • Convert a pdf file to searchable PDF

    I have a lot of pdf files that I use in my daily life of the company, not that I can use the search feature and some that I can't. Can someone tell me the best way to make it where I can change the searchable pdf file.

    You must have Acrobat, Yes. If you do it's very simple, just go to tools - text recognition and run it on the entire file.

  • The hierarchy of Concept provides all of the features beyond research opportunities?

    All types of specifications contain two fields in "approved for use in": Concept and GSM Business Unit. We have activated the GSM BU security on our 6.1.0.1 facilities and are looking for additional controls between groups of users, workflow (terms), the expansion of the BU values, etc.

    I'm trying to estimate if the values of the Concept provide safe behavior control or workflow. So far, I have nothing affecting awareness Concept found a spec to all features except searchable EQT. Y at - it is not its place in PLM4P that the Concept can be used for conditional access / observation of objects spec?

    Thank you.

    It's just a secondary taxonomy, you can use to categorize where your specifications can be used. For example, some clients, you can not think of approved for use by a simple flat list of countries instead of this, they think using a more complex view of the taxonomy.

    For example, a customer of catering service can have 3 types of stores. You may designate that a material can be used in the type of restaurant A against coffee.

    Your products and how you define where they are licensed to be used will really define this list. You can divide it into all the concepts you want to and even add countries as nodes under them.

    This will be tested, but I believe you can also have mixed approaches. A type spec watch concept while the other shows the country.

  • Library searchable PDF - new trends

    Hi all

    We have a new product that needs a NEW helper library and product online. And I am faced with quite a few questions, I hope you can help:

    1. up to now, we have a library of traditional product delivered with the product. I have created manuals in Office Word, and then converted to PDF format (I have Adobe Acrobat 8 Professional). I don't like the fact that it is much too flat. I wish - if I have to keep the manual format pdf - the library of product must be searchable. Not in a SINGLE pdf, but through everything, as you it comme vous l' avez have would be with a Web site. Is it still possible?

    2. the online help and the webhelp I create and edit with Robohelp 8 and close up with the traditional .chm file and htm files. Can you please tell me what are the new trends? DC, I think that our aid is quite obsolete comes to format and look-and-feel. I want to make things simple for the user and pleasant to the eye, without losing ease of use.

    I know I ask too much, but any help will be much appreciated!

    Thank you!

    Zita

    A feature that you might look into is the catalog functionality in Acrobat Pro. for the full text search. This will allow you to search across multiple PDF files. Here is a link to a video tutorial that explains how to create a full text index - How to create searchable reports.

Maybe you are looking for