LISTVIEW - different styles

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

    • LISTVIEW - different styles

      Would it be possible to have, in a listview, 2 different styles on the rows?
      I mean, one row with an icon and text -> different column width definitions and the other row with other column definitions?

      See attachment for a better view of what I mean :)
      Images
      • screen.jpg

        8.46 kB, 138×110, viewed 4,626 times
    • Hello,

      not exactly clear what you want, but if you need "Warning Description" instead of the header then just place another widget (text or image...) over the header.

      If you need to do something more complicated, exactly a row with "one column style" inside the listview table, then you can set owner draw function where you can get the coords of the row and then draw "overlay data" (text, bitmaps...) in WM_PAINT handler of the listview callback.

      Alex.
    • Hi Alex,

      Thanks for the support in my issue.

      The window I want to create got 2 different Row styles, each 2 columns but with different content.
      As you can see one row style got left small icon and right a text.
      Depending on the amount of "warnings" or "faults" (orange rows) the other row style must start.
      This is a big text on the left side and a value on the right side.

      In the complete list I need to be able to scroll by pressing a button up or down.

      I think I will give it a try to set up one column in a row and have a play with the paint functions.

      Keep you guys posted :)
      Images
      • Capture.PNG

        49.11 kB, 847×164, viewed 728 times
    • Hello,

      if it is just some kind of an event log then things are a bit easier.

      Indeed you can do a listview with one column and use default API functions for setting a bitmap and bk color for warning and fault messages.

      For messages with the parameters values you can use owner draw function for justifying the text on opposite sides of a row.

      Alex.
    • Hi,

      The parameter values are updated every second .. so the left side (parameter name, text) is still the same, but the value (right side) can be different..

      So I need a system in the paint, where I can check in my one column, where is my parameter name and where is my parameter value? So I know how I can update only the value :)
    • I've found a work around.

      I've created 3 columns in my listView, and played with the content placing negative, so I could move it to the left, outside the defined column width.

      should be a nice feature, to define a style class on a listview row :)
    • Hello,
      you can use LISTVIEW_SetOwnerDraw (LISTVIEW_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawItem)
      for example :
      LISTVIEW_Handle _hListView;
      _hListView = LISTVIEW_CreateUser(LCD_UPPER_LISTVIEW_X_POSITION , LCD_UPPER_LISTVIEW_Y_POSITION ,
      LCD_LOWER_LISTVIEW_X_POSITION , LCD_LOWER_LISTVIEW_Y_POSITION ,
      hWin, WM_CF_SHOW , 0, GUI_ID_LISTVIEW0, sizeof(int));
      LISTVIEW_SetOwnerDraw(_hListView, &my_OwnerDrawListview);


      my_OwnerDrawListview.txt