misalignment of radio button

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

    • misalignment of radio button

      Hi all,
      I have a LCD display of size 320*240. i have one window which is having 11 radio button . I have to refresh the window whenever change is happened not from touch but based on some settings so i am calling refresh screen where i will delete the swipelist window and create again.
      Since i have to maintain the position even after refreshing the window so i am calling SWIPELIST_GetScrollPos for getting the position and SWIPELIST_GetScrollPos for setting the position after creating the swipelist but the problem is that when scroll position is more than -245 there is a position change in radio button. What i found is that this radio button which is coming in wrong position is related to the item just above the First item i.e 6. Any idea why it is happening.?
      .
    • Hi,

      not sure why this is happening.

      If possible you can post the code where you set up the SWIPELIST and the RADIO buttons and I will take a look into it.

      Regards,
      Sven
      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.
    • Hi,

      I don't have any issues regarding misalignment.

      Here is my code:

      C Source Code

      1. #include "DIALOG.h"
      2. #include <stdio.h>
      3. /*********************************************************************
      4. *
      5. * Externals
      6. *
      7. **********************************************************************
      8. */
      9. /*********************************************************************
      10. *
      11. * Types
      12. *
      13. **********************************************************************
      14. */
      15. /*********************************************************************
      16. *
      17. * Defines
      18. *
      19. **********************************************************************
      20. */
      21. #define ID_CHECKBOX_0 (WM_USER + 0x00)
      22. #define ID_CHECKBOX_99 (WM_USER + 0x63)
      23. #define NUM_BOXES 100
      24. /*********************************************************************
      25. *
      26. * Static data
      27. *
      28. **********************************************************************
      29. */
      30. /*********************************************************************
      31. *
      32. * Static code
      33. *
      34. **********************************************************************
      35. */
      36. /*********************************************************************
      37. *
      38. * _UncheckBoxes
      39. */
      40. static void _UncheckBoxes(WM_HWIN hParent, int Id) {
      41. int i;
      42. WM_HWIN hItem;
      43. for (i = 0; i < NUM_BOXES; i++) {
      44. if (ID_CHECKBOX_0 + i == Id) {
      45. continue;
      46. }
      47. hItem = WM_GetDialogItem(hParent, ID_CHECKBOX_0 + i);
      48. CHECKBOX_SetState(hItem, 0);
      49. }
      50. }
      51. /*********************************************************************
      52. *
      53. * _cbSwipeList
      54. */
      55. static void _cbSwipeList(WM_MESSAGE * pMsg) {
      56. int Id;
      57. int NCode;
      58. switch (pMsg->MsgId) {
      59. case WM_NOTIFY_PARENT:
      60. Id = WM_GetId(pMsg->hWinSrc);
      61. NCode = pMsg->Data.v;
      62. if (Id >= ID_CHECKBOX_0 && Id <= ID_CHECKBOX_99) {
      63. if (NCode == WM_NOTIFICATION_CLICKED) {
      64. _UncheckBoxes(pMsg->hWin, Id);
      65. }
      66. }
      67. break;
      68. default:
      69. SWIPELIST_Callback(pMsg);
      70. break;
      71. }
      72. }
      73. /*********************************************************************
      74. *
      75. * _cbCheckbox
      76. */
      77. static void _cbCheckbox(WM_MESSAGE * pMsg) {
      78. int xSize;
      79. int ySize;
      80. switch (pMsg->MsgId) {
      81. case WM_PAINT:
      82. xSize = WM_GetWindowSizeX(pMsg->hWin);
      83. ySize = WM_GetWindowSizeY(pMsg->hWin);
      84. GUI_SetColor(GUI_WHITE);
      85. GUI_SetPenSize(2);
      86. GUI_AA_DrawCircle(xSize / 2, ySize / 2, xSize / 2 - 3);
      87. if (CHECKBOX_GetState(pMsg->hWin) == 1) {
      88. GUI_AA_FillCircle(xSize / 2, ySize / 2, xSize / 2 - 6);
      89. }
      90. break;
      91. default:
      92. CHECKBOX_Callback(pMsg);
      93. break;
      94. }
      95. }
      96. /*********************************************************************
      97. *
      98. * _cbBk
      99. */
      100. static void _cbBk(WM_MESSAGE * pMsg) {
      101. switch (pMsg->MsgId) {
      102. case WM_PAINT:
      103. GUI_SetBkColor(GUI_BLACK);
      104. GUI_Clear();
      105. break;
      106. default:
      107. WM_DefaultProc(pMsg);
      108. break;
      109. }
      110. }
      111. /*********************************************************************
      112. *
      113. * Public code
      114. *
      115. **********************************************************************
      116. */
      117. /*********************************************************************
      118. *
      119. * MainTask
      120. */
      121. void MainTask(void) {
      122. WM_HWIN hSwipelist;
      123. WM_HWIN hItem;
      124. int i;
      125. char acBuffer[4];
      126. GUI_Init();
      127. WM_MULTIBUF_Enable(1);
      128. WM_SetCallback(WM_HBKWIN, _cbBk);
      129. hSwipelist = SWIPELIST_CreateEx(0, 0, 320, 240, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_SWIPELIST0);
      130. WM_SetCallback(hSwipelist, _cbSwipeList);
      131. for (i = 0; i < NUM_BOXES; i++) {
      132. sprintf(acBuffer, "%i", i);
      133. SWIPELIST_AddItem(hSwipelist, acBuffer, 30);
      134. hItem = CHECKBOX_Create(0, 0, 20, 20, 0, ID_CHECKBOX_0 + i, WM_CF_SHOW | WM_CF_HASTRANS);
      135. WM_SetCallback(hItem, _cbCheckbox);
      136. SWIPELIST_ItemAttachWindow(hSwipelist, i, hItem, 160, 5);
      137. }
      138. while (1) {
      139. GUI_Delay(100);
      140. }
      141. }
      142. /*************************** End of file ****************************/
      Display All

      Regards,
      Sven
      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.
    • Hi Seven. While creation Even I dont have any problem but problem is coming when suppose i am at 7th radio button position and at that time i have to delete and create the swipe list to refresh the screen but there i need to even retain the position i.e 7th radio button for that i am doing like this.

      if(SWIPELIST_GetNumItems(SwipeListHndl) > 3)
      {
      Lvl2ScrollPos = SWIPELIST_GetScrollPos(SwipeListHndl); // take the scroll position before refreshing to stay in the same position after refresh
      }
      GUI_EndDialog(g_SettWinHndl,DIALOG_RETURN_VAL);
      g_SettWinHndl = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbSettingsDialog, g_SettMainWinHndl, 3, 32);
      WM_SetCreateFlags(WM_CF_MEMDEV);
      WM_EnableMemdev(g_SettWinHndl);
      if(SWIPELIST_GetNumItems(SwipeListHndl) > 3)
      {
      SWIPELIST_SetScrollPos(SwipeListHndl,Lvl2ScrollPos);
      }

      after this when screen is created that problem is coming that too when scroll position is below -245.

      Can you please try it whether it is happening same for you.

      Thanks
      Kusum