SWIPELIST and Iconview problem

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

  • SWIPELIST and Iconview problem

    Hello everyone, I'm using stemwin on a stm32f746ng disco board to develop a motorcycle computer. So I started coding the Menù using the function SWIPELIST.
    the structure is the following:
    SPLASHSCREEN-->SPEEDOMETER INTERFACE--> MENU LEVEL 1-->2-->3
    Now the problem is relative to swipelist menu. I used as template the menustruct example. If in speedometer interface i press a butto gui ends and starts menu. In menu I have an iconview that stops gui and bring me back to speedo and this works. Pressing the menu voice that stops menu level 1 to bring me to menu level 2 completely crashes the whole program, the board hangs itself. I'm attaching the code so maybe someone better than me at coding can help me out. By the way I'm using this function to change from a menu to the other in swipe list

    //case WM_NOTIFICATION_RELEASED:
    //hItem = WM_GetDialogItem(pMsg->hWin, ID_SWIPELIST_0);
    //ItemIndex = SWIPELIST_GetReleasedItem(hItem);
    //if (ItemIndex == 0){
    // GUI_EndDialog(pMsg->hWin, 0);
    // GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), _cbDialog2, WM_HBKWIN, 0, 0);
    // }
    Is there something wrong with the use of this code? I'm just asking for the number of object in the list that has been pressed and released and than i assign a function to that number.
    Another problem is that if the toch screen is touched with 2 fingers the program hangs totally the same as described before. How can I avoid that??


    Looking further for some help, thank you
    Files
    • menunew.zip

      (2.1 kB, downloaded 267 times, last: )
  • Hi,

    I'm not sure if I really understood the problem.

    But I changed your code a little bit which makes it possible to navigate through some menus.

    Now you can click on the first SWIPELIST entry and can navigate to the menu where all entries are named 'c'. On a click on the back 'Button' you get back to the previous screen.

    Some things I have discovered which might be not a good idea or lead to unpredictable behavior.

    1.
    Make sure your handles are valid. At one point you have used an uninitialized handle, most compiler should throw a warning.

    2.
    Avoid using a GUI_WIDGET_CREATE_INFO structure which doesn't fit to the callback (like below). This might work but can lead to unpredictable behavior.
    GUI_CreateDialogBox(_aDialogCreate3, GUI_COUNTOF(_aDialogCreate2), _cbDialog2, WM_HBKWIN, 0, 0);

    Regards,
    Sven
    Files
    • CreateMenu.zip

      (2.09 kB, downloaded 289 times, last: )
    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.
  • Thank you for the fast response. I compiled everything and flashed i have still the same problem as before because it hangs after touching the first element of swipelist. Can you point me at the changes you made? What would you use to switch screen the way my program is structured? Thank you.

    The post was edited 1 time, last by rochi2211 ().

  • I'm really struggling to get this working... is there any prticoular function , routine or way to go from a screen to another in swipelist?

    SEGGER - Schoenen wrote:

    Hi,

    I'm not sure if I really understood the problem.

    But I changed your code a little bit which makes it possible to navigate through some menus.

    Now you can click on the first SWIPELIST entry and can navigate to the menu where all entries are named 'c'. On a click on the back 'Button' you get back to the previous screen.

    Some things I have discovered which might be not a good idea or lead to unpredictable behavior.

    1.
    Make sure your handles are valid. At one point you have used an uninitialized handle, most compiler should throw a warning.

    2.
    Avoid using a GUI_WIDGET_CREATE_INFO structure which doesn't fit to the callback (like below). This might work but can lead to unpredictable behavior.
    GUI_CreateDialogBox(_aDialogCreate3, GUI_COUNTOF(_aDialogCreate2), _cbDialog2, WM_HBKWIN, 0, 0);

    Regards,
    Sven
  • I've not been able to succed in my purpouse, the only thing that makes this work is commenting out GUI_EndDialog(hWin, 0); in

    case WM_NOTIFICATION_RELEASED:
    hItem = WM_GetDialogItem(pMsg->hWin, ID_SWIPELIST_0);
    ItemIndex = SWIPELIST_GetReleasedItem(hItem);
    if (ItemIndex == 1) {
    //GUI_EndDialog(hWin, 0);
    //GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), _cbDialog2, WM_HBKWIN, 0, 0);
    CreateSplash();
    }
    Will I run out of memory?
  • rochi2211 wrote:

    I've not been able to succed in my purpouse, the only thing that makes this work is commenting out GUI_EndDialog(hWin, 0); in

    case WM_NOTIFICATION_RELEASED:
    hItem = WM_GetDialogItem(pMsg->hWin, ID_SWIPELIST_0);
    ItemIndex = SWIPELIST_GetReleasedItem(hItem);
    if (ItemIndex == 1) {
    //GUI_EndDialog(hWin, 0);
    //GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), _cbDialog2, WM_HBKWIN, 0, 0);
    CreateSplash();
    }
    Will I run out of memory?

    Attached the rearranged code.
    The first problem is that I suspect that memory is totally eaten and that I can use Gui_enddialog only on the first level. I can't use iconview button with that function in menu level 2 and 3. The other problem is that I will associate programs for settings with every menu voice so for sure i will get out of memory. Is there any solution to execute every menu level as single program? Thank you
    Files
    • menunew.zip

      (2.36 kB, downloaded 281 times, last: )