ListCell String

I have a ListModel that contains multiple columns (ListCells). My ListBox however only allows the selection of rows. The function mdlListCell_getStringValue( ) will return the string of a given ListCell but I need to get the string of a particular ListCell (in my case 0) of a known row. Please advise.

Parents
  • ListBoxes & ListModels

    There's an article about ListModels, ListCells, and Cell Editors.

    There's an example MDL project you can obtain from that page. It shows an example dialog with a ListBox that stores a ListModel. The hooks functions in the MDL code show how to react to a button click in the ListBox, and extract information from the corresponding ListRow.

    It's mostly getting pointers to objects. There are several ways to find the current cursor location …

    #include <ditemlib.fdf>

    • mdlDialog_listBoxGetLocationCursor
    • mdlDialog_listBoxFindCell
    • mdlDialog_listBoxGetSelections
    • mdlDialog_listBoxGetSelectionsX
    • mdlDialog_listBoxGetSelectRange

    Once you have the selected row, you get a pointer into your ListModel …

    #include <listmodel.fdf>

    ListRow* pRow = mdlListModel_getRowAtIndex (listModel, index);

    Then, get the cell in that row …

    ListCell* pCell = mdlListRow_getCellAtIndex (pRow, colIndex);

    Or, combine the two operations …

    ListCell* pCell = mdlListModel_getCellAtIndexes (listModel, rowIndex, colIndex);

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Jon -

    Thanks for your reply but here is my dilemma... My ListRow contains multiple ListCells however I need the string stored in the fist cell (0) of the selected row, regardless of which cell the user actually clicked on.

Reply Children