Problem with LISTVIEW widget row selection

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

  • Problem with LISTVIEW widget row selection

    Hello,

    I am using handle= LISTVIEW_CreateEX() to create LISTVIEW.
    But my handle is not responding to my clicks on each row...
    function LISTVIEW_getsel is returning -1 every time.
    I see all example programs using only WM_CreateIndirect
    to create the list view...
    Can i not use above function ?
  • Hi,

    Of course you can this function.
    It returns -1 if no row is selected. You can try the following example, it displays the selected row. At the beginning it shows -1 when no row is selected.

    #include "GUI.h"
    #include "LISTVIEW.h"

    void MainTask(void) {
    LISTVIEW_Handle hListView;
    GUI_ConstString String = {"Test"};
    int SelectedRow;

    GUI_Init();

    hListView = LISTVIEW_CreateEx(0, 0, 200, 200, WM_HBKWIN, WM_CF_SHOW, 0, 0);
    LISTVIEW_AddColumn(hListView, 50, "Column", 0);
    LISTVIEW_AddRow(hListView, &String);
    LISTVIEW_AddRow(hListView, &String);
    LISTVIEW_AddRow(hListView, &String);
    LISTVIEW_AddRow(hListView, &String);

    while (1) {
    GUI_Delay(500);
    GUI_Clear();
    SelectedRow = LISTVIEW_GetSel(hListView);
    GUI_DispStringAt("Row", 210, 20);
    GUI_DispDecAt(SelectedRow, 230, 20, 3);
    }
    }

    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.