LISTVIEW_GetItemTextSorted

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • LISTVIEW_GetItemTextSorted

    Hello,

    I was trouble in getting items from the listview Widget after performing a sort.
    I looked at the one of the samples and found LISTVIEW_GetItemTextSorted function. It is not listed in the documentation that I could find.
    However the demo gave the information needed.
  • One more this to add:

    After I do a Listview sort, I would like to place the selected row back to the top of the listview.
    In other words blue bar at the very top.

    LISTVIEW_SetSort(hList,WidgetData.sortcol,0) // do a sort


    LISTVIEW_SetSel(hList,0); // place selected bar at very top of listview widget





    Now there is a LISTVIEW_SetSelUnsorted(hList,0) function which I found in the header file, but I does not seem
    to be a difference.



  • Hi,

    We will add the functions LISTVIEW_SetSelUnsorted() and LISTVIEW_GetItemTextSorted() to the documentation.

    I checked the function LISTVIEW_SetSelUnsorted(). It sets the selection to the item which was initially the item with the given index. This means, if item with index 0 is after a sort the third item (index 2), this function sets the selection to the third item. The function LISTVIEW_SetSel() sets the selection always to the item with the given index, no matter which index the item had initially.

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Thank you for your reply.
    So I have a ListView with 4 columns.
    "ID Number, "Time", "Date", "Record Type
    There is no touch or mouse pointer for this application.
    Only a keypad. Pressing a key selects the column to sort. I can toggle between all the columns and sorting works fine.
    Below is the code statement.

    LISTVIEW_SetSort(hList,WidgetData.sortcol,1);
    LISTVIEW_SetSel(hList,0);

    After every sort I require the "select bar" to be at the very top of the ListView.
    So I use LISTVIEW_SetSel(hList,0) after the column sort.


    It did not seem to work.
    For testing I added another key that calls LISTVIEW_SetSel(hList,0).
    That works fine.


    So in summery if I press key 'A' to sort a column in the ListView, and press key 'B' to Select the first index of the ListView it works fine.
    But using LISTVIEW_SetSel(hList,0) right after a column sort does not seem to work.
    Like there is a race condition or something.