LISTVIEW_SetRBorder and LISTVIEW_SetLBorder don't work.

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

    • LISTVIEW_SetRBorder and LISTVIEW_SetLBorder don't work.

      Hello,

      I'm trying to create a LISTVIEW widget in the centre of a window. The problem is that the LISTVIEW that I create does not have the left border. I tried LISTVIEW_SetLBorder(ListviewHandle, 1); but it seems to not work at all. I also tried using LISTVIEW_SetRBorder(ListviewHandle, 0); to remove the right border, just to see if the function works but I had the same result - this function also does not seem have any effect || .

      Please, tell me what I'm doing wrong or how to create a LISTVIEW widget with both right and left borders. Here is my callback function for the window in which I want to create the LISTVIEW.


      Source Code

      1. static void
      2. cbTableOfResultsWindow (WM_MESSAGE *pMsg)
      3. {
      4. //**************************************************************************
      5. switch (pMsg->MsgId)
      6. {
      7. //**********************************************************************
      8. case WM_PAINT:
      9. {
      10. GUI_SetBkColor(GUI_BROWN); // debug
      11. GUI_Clear();
      12. break;
      13. }
      14. //**********************************************************************
      15. case WM_CREATE:
      16. {
      17. LISTVIEW_Handle ListviewHandle;
      18. HEADER_Handle hHeader;
      19. int Columns = 4;
      20. int Rows = 5;
      21. int ColWidth = (int)(300 / Columns);
      22. int RowHeight = (int)(100 / Rows);
      23. int BorderH = 0;
      24. int BorderV = 0;
      25. // create the listview
      26. ListviewHandle = LISTVIEW_CreateEx(TAB_OF_RESULTS_MARGIN,
      27. TAB_OF_RESULTS_MARGIN,
      28. 300+1, // 1 extra pixel to show the right border
      29. 100,
      30. pMsg->hWin,
      31. WM_CF_SHOW,
      32. 0,
      33. UI_ID_TAB_OF_RESULTS_LISTVIEW);
      34. WIDGET_SetEffect(ListviewHandle, &WIDGET_Effect_None);
      35. LISTVIEW_SetGridVis(ListviewHandle, true);
      36. // create columns
      37. for (uint8_t i = 0; i < Columns; i++)
      38. {
      39. LISTVIEW_AddColumn(ListviewHandle,
      40. ColWidth,
      41. NULL,
      42. GUI_TA_VCENTER | GUI_TA_HCENTER);
      43. }
      44. hHeader = LISTVIEW_GetHeader(ListviewHandle);
      45. HEADER_SetHeight(hHeader, RowHeight);
      46. // create rows
      47. for (uint8_t i = 0; i < Rows; i++)
      48. {
      49. LISTVIEW_AddRow(ListviewHandle, NULL);
      50. }
      51. LISTVIEW_SetRowHeight(ListviewHandle, RowHeight);
      52. // !!! these two don't work !!!
      53. LISTVIEW_SetRBorder(ListviewHandle, 0);
      54. LISTVIEW_SetLBorder(ListviewHandle, 1);
      55. break;
      56. }
      57. //**********************************************************************
      58. default:
      59. {
      60. WM_DefaultProc(pMsg);
      61. break;
      62. }
      63. }
      64. }
      Display All

      Regards
      Piotr
    • New

      Hi,

      On my end this is working fine. To see the effect of the border functions you have to set a text to a cell.

      Here is the callback fucntion with some changes to make the border visible (or better not visible since they are 0 and 1).

      C Source Code

      1. static void _cbTableOfResultsWindow(WM_MESSAGE *pMsg) {
      2. LISTVIEW_Handle ListviewHandle;
      3. HEADER_Handle hHeader;
      4. int Columns = 4;
      5. int Rows = 5;
      6. int ColWidth = (int)(300 / Columns);
      7. int RowHeight = (int)(100 / Rows);
      8. int BorderH = 0;
      9. int BorderV = 0;
      10. int i;
      11. switch (pMsg->MsgId) {
      12. case WM_PAINT: {
      13. GUI_SetBkColor(GUI_BROWN); // debug
      14. GUI_Clear();
      15. break;
      16. }
      17. case WM_CREATE: {
      18. // create the listview
      19. ListviewHandle = LISTVIEW_CreateEx(10, 10, 300, 100, pMsg->hWin, WM_CF_SHOW, 0, GUI_ID_LISTVIEW0);
      20. WIDGET_SetEffect(ListviewHandle, &WIDGET_Effect_None);
      21. LISTVIEW_SetGridVis(ListviewHandle, 1);
      22. // create columns
      23. for (i = 0; i < Columns; i++) {
      24. LISTVIEW_AddColumn(ListviewHandle, ColWidth, NULL, GUI_TA_VCENTER | GUI_TA_HCENTER); // If the string is too short the border functions have allmost no effect.
      25. // Try to use GUI_TA_LEFT/RIGHT to see the effect of the border functions
      26. }
      27. hHeader = LISTVIEW_GetHeader(ListviewHandle);
      28. HEADER_SetHeight(hHeader, RowHeight);
      29. // create rows
      30. for (i = 0; i < Rows; i++) {
      31. LISTVIEW_AddRow(ListviewHandle, NULL);
      32. }
      33. LISTVIEW_SetRowHeight(ListviewHandle, RowHeight);
      34. // !!! these two don't work !!!
      35. LISTVIEW_SetItemText(ListviewHandle, 0, 0, "ALongTestStringWhichShouldntFitIntoOneCell"); // no border to the right, and 1p border left
      36. LISTVIEW_SetRBorder(ListviewHandle, 0);
      37. LISTVIEW_SetLBorder(ListviewHandle, 1);
      38. break;
      39. }
      40. default: {
      41. WM_DefaultProc(pMsg);
      42. break;
      43. }
      44. }
      45. }
      Display All
      Regards,
      Sven