Questions about LISTSVIEW widget

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

  • Questions about LISTSVIEW widget

    Hi,
    I have serveral questions about the LISTVIEW widget:
    - Is right-mouse click supported?
    - Is it possible to display a bitmap (not known at compile time) in a LISTVIEW cell?
    - Is it possible to have a editable cell in a LISTVIEW? I would like to have a DROPDOWN and/or CHECKBOX in a cell. This is very important to me, if not possible, can you suggest another way this may be implemented?
    Thank you,
    Nosreme
  • Hello Nosreme,

    - Yes, right-click is supported. Please refer to the chapter 23.2 "Pointer input device API" in the emWin user manual for detailed information.
    - Yes, bitmaps which are not known at compile time (e.g. stored on SD-Card) can be displayed using the ...Ex()-version of the functions to display common bitmap formats, as described in the chapter 8 "Displaying bitmap files".
    - Yes, you can create any widget as a child window of another widget. The child window is usually displayed in front of the parent window.

    If you have any further questions, please let me know.

    Best regards,
    Adrian
  • Good afternoon.
    I have the following problem.
    Using Keil MCBSTM32F400 Evaluation Board and KeilOs with emWin V5.16.
    Create Windows, you've created ListView. I see the cursor, the touchscreen works fine. Add in ListView empty line:

    C Source Code

    1. LISTVIEW_AddRow (hListView, NULL);

    All is well.

    Fill the cell in the ListView:

    C Source Code

    1. LISTVIEW_SetItemText (hListView, 0, 0, "1");



    After that, I lost the cursor on the screen and touch screen does not respond to clicks.
    It should comment the line

    C Source Code

    1. LISTVIEW_SetItemText (hListView, 0, 0, "1");


    everything starts working normally.

    I'm confused. In what could be the problem?
  • Hello Adrian.
    I think that it's not in memory. I allocate memory like this:
    (File GUIConfig.c)

    C Source Code

    1. #include "GUI.h"
    2. #define GUI_NUMBYTES 0xFFFF
    3. #define GUI_BLOCKSIZE 0x80
    4. void GUI_X_Config(void) {
    5. static U32 aMemory[GUI_NUMBYTES / 4];
    6. GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES);
    7. GUI_ALLOC_SetAvBlockSize(GUI_BLOCKSIZE);
    8. }


    I think that the memory for one window and LISTVIEW should suffice. All the more so with the windows, which are a large number of components, there is no problem.
    Here is my code window

    C Source Code

    1. #include "DIALOG.h"
    2. #define ID_WINDOW_0 (GUI_ID_USER + 0x00)
    3. #define ID_LISTVIEW_0 (GUI_ID_USER + 0x01)
    4. static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
    5. { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 320, 240, 0, 0, 0 },
    6. { LISTVIEW_CreateIndirect, "Listview", ID_LISTVIEW_0, 0, 0, 257, 223, 0, 0, 0 },
    7. };
    8. static void _cbDialog(WM_MESSAGE * pMsg) {
    9. WM_HWIN hItem;
    10. int Id, NCode;
    11. switch (pMsg->MsgId) {
    12. case WM_INIT_DIALOG:
    13. hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTVIEW_0);
    14. LISTVIEW_AddColumn(hItem, 30, "Col 0", GUI_TA_HCENTER | GUI_TA_VCENTER);
    15. LISTVIEW_AddColumn(hItem, 30, "Col 1", GUI_TA_HCENTER | GUI_TA_VCENTER);
    16. LISTVIEW_AddColumn(hItem, 30, "Col 2", GUI_TA_HCENTER | GUI_TA_VCENTER);
    17. LISTVIEW_AddRow(hItem, NULL);
    18. LISTVIEW_SetGridVis(hItem, 1);
    19. LISTVIEW_SetItemText(hItem, 0, 0, "Item");
    20. LISTVIEW_SetFont(hItem, GUI_FONT_20_1);
    21. break;
    22. case WM_NOTIFY_PARENT:
    23. Id = WM_GetId(pMsg->hWinSrc);
    24. NCode = pMsg->Data.v;
    25. switch(Id) {
    26. case ID_LISTVIEW_0: // Notifications sent by 'Listview'
    27. switch(NCode) {
    28. case WM_NOTIFICATION_CLICKED:
    29. break;
    30. case WM_NOTIFICATION_RELEASED:
    31. break;
    32. case WM_NOTIFICATION_SEL_CHANGED:
    33. break;
    34. }
    35. break;
    36. }
    37. break;
    38. default:
    39. WM_DefaultProc(pMsg);
    40. break;
    41. }
    42. }
    43. WM_HWIN CreateWindow(void);
    44. WM_HWIN CreateWindow(void) {
    45. WM_HWIN hWin;
    46. hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbDialog, WM_HBKWIN, 0, 0);
    47. return hWin;
    48. }
    Display All

    (Code generated with GUIBuilder).

    That's how I create the window

    C Source Code

    1. __task void MainGUITask(void) {
    2. WM_HWIN hSignalTableWin;
    3. GUI_Clear();
    4. hSignalTableWin = CreateWindow();
    5. GUI_CURSOR_Show();
    6. os_tsk_delete_self ();
    7. }

    (Initialization GUI I make earlier.)

    It should comment out

    C Source Code

    1. LISTVIEW_SetItemText(hItem, 0, 0, "Item");

    As the cursor is visible and starts working touchscreen.

    As another option - write:

    C Source Code

    1. LISTVIEW_SetItemText(hItem, 0, 0, "Item");
    2. LISTVIEW_SetItemText(hItem, 0, 0, " ");


    and the cursor appears, too, of course, the cell is empty :)

    Or you can do this:

    C Source Code

    1. LISTVIEW_AddRow(hItem, NULL);
    2. LISTVIEW_SetGridVis(hItem, 1);
    3. LISTVIEW_SetItemText(hItem, 0, 0, "Item");
    4. LISTVIEW_SetItemText(hItem, 0, 0, " ");
    5. LISTVIEW_AddRow(hItem, NULL);
    6. LISTVIEW_SetItemText(hItem, 0, 1, "Item1");
    7. LISTVIEW_SetItemText(hItem, 0, 1, " ");

    and the cursor is visible, touch screen work.

    And this is - the cursor will not and touch screen does not work:

    C Source Code

    1. LISTVIEW_AddRow(hItem, NULL);
    2. LISTVIEW_SetGridVis(hItem, 1);
    3. LISTVIEW_SetItemText(hItem, 0, 0, "Item");
    4. //LISTVIEW_SetItemText(hItem, 0, 0, " "); // comment!!!
    5. LISTVIEW_AddRow(hItem, NULL);
    6. LISTVIEW_SetItemText(hItem, 0, 1, "Item1");
    7. LISTVIEW_SetItemText(hItem, 0, 1, " ");

    Here's my other Task's:

    C Source Code

    1. __task void TouchTask (void) {
    2. os_itv_set (10);
    3. while (1) {
    4. GUI_TOUCH_Exec(); // Execute Touch Screen function
    5. Joystick_Exec(); // Execute Joystick function
    6. os_itv_wait ();
    7. }
    8. }


    C Source Code

    1. __task void GUITask(void) {
    2. while(1) {
    3. GUI_Exec(); /* Do the background work ... Update windows etc.) */
    4. GUI_X_ExecIdle(); /* Nothing left to do for the moment ... Idle processing */
    5. }
    6. }


    Have any ideas?
  • Hello Toff,

    I copied your code and created a small test. The following code works well:

    Source Code

    1. /*********************************************************************
    2. *
    3. * MainTask
    4. */
    5. void MainTask(void) {
    6. LISTVIEW_Handle hList;
    7. unsigned NumRows;
    8. unsigned NumCols;
    9. GUI_Init();
    10. hList = LISTVIEW_CreateEx(10, 10, 200, 100, WM_HBKWIN, WM_CF_SHOW, 0, 0);
    11. LISTVIEW_AddColumn(hList, 30, "Col 0", GUI_TA_HCENTER | GUI_TA_VCENTER);
    12. LISTVIEW_AddColumn(hList, 30, "Col 1", GUI_TA_HCENTER | GUI_TA_VCENTER);
    13. LISTVIEW_AddColumn(hList, 30, "Col 2", GUI_TA_HCENTER | GUI_TA_VCENTER);
    14. LISTVIEW_AddRow(hList, NULL);
    15. NumCols = LISTVIEW_GetNumColumns(hList);
    16. NumRows = LISTVIEW_GetNumRows(hList);
    17. GUI_Delay(100);
    18. LISTVIEW_SetGridVis(hList, 1);
    19. GUI_Delay(100);
    20. LISTVIEW_SetItemText(hList, 0, 0, "Item");
    21. GUI_Delay(100);
    22. LISTVIEW_AddRow(hList, NULL);
    23. GUI_Delay(100);
    24. LISTVIEW_SetItemText(hList, 0, 1, "Item1");
    25. GUI_Delay(100);
    26. LISTVIEW_SetItemText(hList, 0, 1, " ");
    27. GUI_Delay(100);
    28. while (1) {
    29. GUI_Delay(100);
    30. }
    31. }
    Display All

    I do not see any problem here. Please note that widgets should not cause the mouse cursor or the touch screen not to work.

    Best regards,
    Adrian
  • Adrian, thanks for the example.
    I think it will be convenient to rely on it when considering this issue.
    I looked at your example and said one nuance. For some reason you do not call the function GUI_CURSOR_Show (), while in emWin Manual states that

    Additional information
    The default setting for the cursor is hidden; therefore this function must be called if you want the cursor to be visible.


    So in your example, I did not see the cursor initially. So I added the challenge GUI_CURSOR_Show ().
    Second, you have given an example for SingleTask.
    I have the same problem occurs just as MultiTask.
    So, I was a little reworked your example:


    C Source Code

    1. #include <stm32f4xx.h> /* STM32F4xx Definitions */
    2. #include <RTL.h>
    3. #include "GUI.h"
    4. #include "WM.h"
    5. #include "DIALOG.h"
    6. #include "I2C.h"
    7. #include "TSC.h"
    8. #include "JOY.h"
    9. #if GUI_OS == 0
    10. #error Multitasking sample requires task awareness (#define GUI_OS 1)
    11. #endif
    12. //**********************************************************************
    13. extern void SystemInit(void);
    14. extern void GUI_TOUCH_Exec(void);
    15. extern void Joystick_Exec(void);
    16. //**********************************************************************
    17. static U64 MainStack[1024/8];
    18. static U64 InitStack[1024/8];
    19. static U64 MainGUIStack[1024/8];
    20. static U64 GUIStack[1024/8];
    21. static U64 TouchStack[1024/8];
    22. __task void MainTask(void);
    23. __task void InitTask(void);
    24. __task void GUITask(void);
    25. __task void MainGUITask(void);
    26. __task void TouchTask(void);
    27. //******************************************************************
    28. //******************************************************************
    29. __task void TouchTask (void) {
    30. os_itv_set (10);
    31. while (1) {
    32. GUI_TOUCH_Exec(); // Execute Touch Screen function
    33. Joystick_Exec(); // Execute Joystick function
    34. os_itv_wait ();
    35. }
    36. }
    37. //******************************************************************
    38. //******************************************************************
    39. __task void InitTask(void) {
    40. SystemInit();
    41. I2C_Init();
    42. TSC_Init();
    43. JOY_Init();
    44. GUI_Init();
    45. // Init done, terminate this task.
    46. os_tsk_delete_self ();
    47. }
    48. //******************************************************************
    49. //******************************************************************
    50. __task void GUITask(void) {
    51. while(1) {
    52. GUI_Exec(); /* Do the background work ... Update windows etc.) */
    53. GUI_X_ExecIdle(); /* Nothing left to do for the moment ... Idle processing */
    54. }
    55. }
    56. //******************************************************************
    57. //******************************************************************
    58. __task void MainGUITask(void) {
    59. LISTVIEW_Handle hList;
    60. unsigned NumRows;
    61. unsigned NumCols;
    62. GUI_CURSOR_Show();
    63. hList = LISTVIEW_CreateEx(10, 10, 200, 100, WM_HBKWIN, WM_CF_SHOW, 0, 0);
    64. LISTVIEW_AddColumn(hList, 30, "Col 0", GUI_TA_HCENTER | GUI_TA_VCENTER);
    65. LISTVIEW_AddColumn(hList, 30, "Col 1", GUI_TA_HCENTER | GUI_TA_VCENTER);
    66. LISTVIEW_AddColumn(hList, 30, "Col 2", GUI_TA_HCENTER | GUI_TA_VCENTER);
    67. LISTVIEW_AddRow(hList, NULL);
    68. NumCols = LISTVIEW_GetNumColumns(hList);
    69. NumRows = LISTVIEW_GetNumRows(hList);
    70. LISTVIEW_SetGridVis(hList, 1);
    71. //LISTVIEW_SetItemText(hList, 0, 0, "Item");
    72. os_tsk_delete_self ();
    73. }
    74. //******************************************************************
    75. //******************************************************************
    76. __task void MainTask(void) {
    77. os_tsk_create_user(InitTask, 1, InitStack, sizeof(InitStack));
    78. os_tsk_create_user(MainGUITask, 1, MainGUIStack, sizeof(MainGUIStack));
    79. os_tsk_create_user(GUITask, 1, GUIStack, sizeof(GUIStack));
    80. os_tsk_create_user(TouchTask, 1, TouchStack, sizeof(TouchStack));
    81. os_tsk_delete_self ();
    82. }
    83. //******************************************************************
    84. //******************************************************************
    85. int main (void) {
    86. os_sys_init_user(MainTask, 1, MainStack, sizeof(MainStack));
    87. for (;;);
    88. }
    89. //******************************************************************
    90. //******************************************************************
    Display All



    Once again faced with the same problem!
    It should uncomment one line

    LISTVIEW_SetItemText (hList, 0, 0, "Item");

    I do not see the cursor!
    As far as I was able to understand these days, I do not use the right emWin in MultiTask mode. Perhaps you can look at my problem from this point of view.
    Maybe you should bring an example emWin in MultiTask mode?

    I would be grateful for your help in solving this problem!