×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    80

    How to highligh a listbox item after construction

    Hi,
    I have an issues with highlight a list box item. I save an index and when the listbox is created I want to highlight that item. For me something is missing. Here is my code. If I click on an item then it select the item and work as usual but I would like to highligt a particular item.

    What should be changed here?

    // load the index set it to currentIndex
    Component.onCompleted:
    {
    countrylistView.currentIndex = SettingObject.ContrySelectedByUser();
    }


    // list view
    ListView
    {
    id: countrylistView
    anchors.fill: parent
    width: window.width; height: window.height
    model: Editcountrylist{ id: countryModel}
    delegate: contrylistDelegate

    /*
    highlightFollowsCurrentItem : true
    highlight: Rectangle
    {
    height: 40
    color: "lightsteelblue"; radius: 5
    }
    */

    highlight: highlight
    highlightFollowsCurrentItem: true
    focus: true
    }


    Component {
    id: highlight
    Rectangle {
    height: 40
    color: "lightsteelblue"; radius: 5
    y: countrylistView.currentItem.y
    Behavior on y {
    SpringAnimation {
    spring: 3
    damping: 0.2
    }
    }
    }
    }

    Br

    Aktar

  2. #2
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: How to highligh a listbox item after construction

    Hi,

    As per the doc,
    the below is set to false. In your code its set to true.

    highlightFollowsCurrentItem: false

    The highlightItem is managed by the view unless highlightFollowsCurrentItem is set to false.

    Have you already solved this problem?

Similar Threads

  1. How to change Listbox item position of Listbox using Up/Down arrow key?
    By rohit.shah in forum Symbian User Interface
    Replies: 3
    Last Post: 2011-05-03, 08:27
  2. Replies: 6
    Last Post: 2009-01-08, 13:06
  3. Replies: 2
    Last Post: 2008-07-01, 02:01
  4. listbox construction
    By nicholasgaye in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-05-11, 17:42
  5. Replies: 1
    Last Post: 2002-11-13, 10:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×