ListField set highlight color

Hello!

I make a list of items, with my own custom ListField. I use the example of TaskListField and change to my design.

I changed the background color of the items correctly, but now I want to change the highlight color of the list item selected from blue to red. I use the drawListRow method:

public void drawListRow(ListField listField, Graphics g, int index, int y, int width) {
        ListaTours list = (ListaTours) listField;

        if(list.getSelectedIndex() == index){
            System.out.println("Selected index: "+index);
            g.clear();
            g.setColor(0xFFb00000);
            g.fillRect(0,(index*this.getRowHeight()), this.getWidth(), this.getRowHeight());
        }
        else{
            g.clear();
            g.setColor(0xe8e8e8);
            g.fillRect(0,(index*this.getRowHeight()), this.getWidth(), this.getRowHeight());
        }
    }

I can successfully change the selected color, but my "problem" is that the first element is always highlighted even if I didn't go. The default variable index value is 0, and makes my first item to be always highlighted. Is it possible to asigning the first value of index-1?

I know I could just substitute the ListField object method, but if I do, my bitmap images do not show up correctly

Thank you in advance!

Instead of

If (List.getSelectedIndex () == index)

try to use

If (g.isDrawingStyleSet (Graphics.DRAWSTYLE_FOCUS))

Tags: BlackBerry Developers

Similar Questions

  • Set the sidebar highlight color

    My highlight color for sidebar Finder is a pale gray.

    How can I change the color?

    TomJay,

    There is no user option to change the color of the sidebar.

    I suggest that you provide: https://www.apple.com/feedback/macosx.html

  • Highlight color of copy / paste

    I get no color at all when I copy and paste.  How can I get a highlight color that I can see what I copy? I have a MAC OS X YOSEMITE 10.10.5

    In System Preferences: General, there is a highlight color picker. Don't know how you came to no highlight because there is no way to disable or change the opacity to zero. I have mine set to blue, but the other part of menu selection reveals a color picker, so you can be creative.

  • How can I control the selection highlighting colors attributed to layers?

    When new layers are created in the layers panel, they are on a default selection highlighting colors. The color for each new layer changes, sequencing with a list of color options. For my personal use, if there is lighting in my office and work, I work with, I find about 75% of the color options to be unusable. In fact, the only definition of color that always works for me is 'Green' (the third option from the top of the list). I work with many layers on each project and I find myself change each layer to Green by hand. Y at - it an option to set the default highlight color for each new layer of a single color rather than go through the list? I looked through all the options that I could find throughout Illustrator without seeing it.

    Create all your layers, select the first layer, hold down the SHIFT key, select the last layer, then double-click to edit all layers to one.

    Or create a template with your layers/names/colors you want and save on a format of model commandeer.

  • How to change the highlight color 'find '.

    I use Dreamweaver CS4 and when I use the 'Search' function to search for something in the source code it highlights the text found with a very light gray background (background color for source code is white).  Is it possible to change the highlight color gray to something else that I often struggle to locate in the source code window, which has been found.  I would like to make a lighter color is no longer perceptible.  I searched through all of the preference settings and can't seem to find a setting for this.  Is this one?

    Thanks for the help!

    Tom

    I'm sorry, I think that you post in the wrong forum.

    The issue in this case relates to the color used by Dreamweaver to highlight the code after using the built in find & replace tool.

    In Dreamweaver CC 2015, the code highlighting color is editable by the user under Edit > Preferences > Code coloring > background selection

  • Set the color to a table Cluster

    Is it possible to set the color, if the table, fonts, cluster, etc. on a specific column and row within a table Cluster? Looking at the properties and methods, it does not seem so. I have no other options that rethink my VI?

    Here's an example of how my data are implemented with the sample data provided.

    I would appreciate any advice.

    Interesting that you should raise this issue.  Coincidentally, a similar question was answered just in time:

    https://forums.NI.com/T5/LabVIEW/change-enum-colour-in-a-cluster-that-is-in-an-array/m-p/2918506#U29...

    Check out Jeff's response and see if maybe you can adapt to your problem.

  • How to set different color for the table column header

    Can I set different colors for the 4 following as being attached.

    -color of the header text

    -the head of the column of the background color

    -color of the text of the content

    -color of background content

    The value of the cluster - 2, -2 to define all of the cells,

    Then go back and the cluster the value-1, -2 to simply set the line header.

    (If you also had a column of row headers, then -2,-1 would set them.  Course the upper left corner which is the intersection of the column header and row header will change with any of them.)

  • Change the highlight color when you select files or folders

    Hello
    Need assistance to change the highlight color when you select files or folders in Windows Explorer / my document.
    I use Windows Vista with SP2.  I tried to go to control-online personalization panel => color & appearance of the window and changing the settings.  However, I can't change the intensity of the highlights that I see it clearly.  A little blind colours, I would like to change the color to make it darker so that I could clearly see when an item is selected.
    I tried open classic appearance for color options properties more-online advance but did not find an appropriate under "Item" option that I could change.  I tried the step "Selected items" under ' point:' but that only applies when I double click on a file or folder.
    Any advice would be greatly appreciated.
    The

    Salvation of

    Sorry to hear that the option is good enough for you.  I've done some research more and that you still do not see a way to change what you're asking.  As I said before, others have mentioned this issue as well.  If I come across a way to do it, I'll post it here.

    In the meantime, I'm going to Mark this post as answer whose answer is:

    Currently, there is no way to make this change in Windows Vista.

    Thanks for posting on Microsoft Answers.
    Ken
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to set the color depth

    try to set the color of amd's message color depth less than 24. How to set the highest color depth?

    If your computer allows you to change this setting, it will be located in the "Control Panel > display > resolution > Advanced Settings > Monitor tab > screen colors.

  • How to change the highlight color for windows 7 (select the file or folder)?

    How to change the highlight color for windows 7 in the aero theme (select the file or folder)?

    You can change the font size because it is not a widget.   To do this:

    1 type dpi in your Start menu search box, and then choose make text and other more or less important.
    2 - Choose a size you prefer
    3 - Click on apply.
  • Set the color for emphasis on the interactive whiteboard to HorizontalFieldManager

    I have an array of horizontal fields that contains a bitmap and a labelfield each. The entire line should be clickable who worked until now, but how do I set the color to accent properly? At the moment the onFocus and onUnfocus functions are completely ignored.

    It's the definition of my table:

    for (int i = 0; i < listSize; i++) {
            logInDetailManager[i] = new HorizontalFieldManager(
                    Manager.USE_ALL_WIDTH | Field.FOCUSABLE) {
    
                protected void onFocus(int direction) {
                    super.onFocus(direction);
                    background_color = Color.RED;
                    invalidate();
                }
    
                protected void onUnfocus() {
                    invalidate();
                    background_color = Color.GREEN;
                }
    

    And that's how I add my horizontal fields:

    logInDetailManager[i].setChangeListener(this);
    logInDetailManager[i].add(dummyIcon[i]);
    logInDetailManager[i].add(new LabelField("hello"));
    logInDetailManager[i].add(new NullField(Field.FOCUSABLE));
    add(logInDetailManager[i]);
    

    Thanks for your help!

    AAH it got already...

    If someone has trouble with this too: I removed onFocus() and onUnfocus and set the background color in the paint so the color of the entire line method is modified when:

    protected void paint(Graphics graphics) {
    
        graphics.setBackgroundColor(isFocus() ? Color.RED : Color.GREEN);
        graphics.clear();
        invalidate();
        super.paint(graphics);
    }
    
  • How to set the color of foreground to EditField

    Hi all

    I added EditField to display new EditField("About:","",1024,EditField.FILTER_DEFAULT).

    Now I want this editfield foreground color value. But there is not setForegroundColor() as setBackgroundColor() in the EditField class.

    Can someone tell me how to set the color of foreground to EditField?

    I think so

    You can change the foreground color by replacing your method of painting:

    That is to say

    editField = new EditField()
    {
        public void paint(Graphics g)
        {
          g.setColor(Color.GRAY);
          super.paint(g);
        }
    };
    
  • you will need to set the color of the labelfield.

    Hi all

    Can someone suggest me, how can I set labelfield color?

    I can able to define the fonts but I m not able to get how will also set the font color.

    Ajay

    LabelField objLabel = new LabelField ("test") {public void paint (Graphics g) {g.setColor (Color.RED); super.paint (g) ;}};}

    Only try this let me know.

  • Highlight color for blackBerry Smartphones

    Someone figured out how to change the highlight color. Try reading white text on a yellow background is a pain.

    you use a particular topic? I use the Zen Dimension theme, ad I have all black and white with the exception of the level 1 messages that appear in black on a stripped red background.

    You can take a photo and post it here? I'm very curious.

  • How to set the color palette for the system colors for the visible record of all controls on the web page?

    The color scheme by default in Windows 7 (x 36, Premium family edition) offers a combination of a white background for the application windows and black text for information that are there.   But being a visually handicapped person, I find the white background rather irritating to the eyes, and I'd rather have a black background, with white text, as this combination gives me a comfortable environment to work on the computer for long periods.  When I set these colors according to my convenience, using the link ' Customize > window color > color and appearance of windows "and by changing only the colours of the just 'Windows' choice in the dialog box, I think the colors of several other controls, in particular the"Drop Down Lists","Framed"and"Buttons"are also changed, often to be the same thus making the information unreadable such controls.  As these color changes seem to be rather random and apparently 'unpredictable', I cannot set the application window, according to my convenience.  I'm not able to get any useful information from the link "Help and Support" of the STARTUP dialog, about the dependencies of the combinations of colors of controls, or the link dialog box "Customize > window color > color and appearance of windows ' lists all controls that are normally used in any typical web page.  After spending a lot of time and effort - and therefore actually "lose" my time at the computer - through several tests, with all giving them negative results, I am at a loss to get this problem is solved.  Furthermore, I can't go back to the default of origin either.  So my computer is idle for a very large part of the day.

    I would be really grateful to all users or personal assistance MS, who take the time to provide me with an answer to this problem and help me use the computer in a fruitful way.  I offer my sincerest thanks in advance to anyone who offers me a complete solution.

    Hello

    I suggest that you go through the Microsoft article and check if it helps.

Maybe you are looking for

  • Cannot install osx after reset mac

    Sir, I have macbook 2007 model max osx10.7.5 is the latest version, then I've been reset by online documents are deleted but os may not re - install to my mac book There is try again later and temporary unavailable as this message coming on screen Af

  • Can I take advantage of discount student on mac in India?

    Hey guys, I'm planning to buy a Macbook air. I know that apple provides discounts student for college level students, can I take advantage of this discount in India?

  • I downloaded El Capitan, but cannot install it

    I have a Mac book pro 15 inch Retina and even if he says it's that el Capitan is downloaded the link is grayed and I can't install it. I am running Yosemite 10.10.5 Thank you

  • Clear the error VI

    There is a situation inside a timed loop where there is a possibility of a function returns an error.  This error can be ignored and the loop Timed allowed to run. Question is what happens in the process of removing this error? The timed loop is trig

  • Download Vista Games

    Business Edition came without card games... I followed the instructions of their marketing, but the map is jerky and hesitant. I did something wrong or is this the standard?