野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5579|回复: 1

iconview 触摸点击问题

[复制链接]
发表于 2020-4-1 14:52:18 | 显示全部楼层 |阅读模式
/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { WINDOW_CreateIndirect, NULL, ID_WINDOW_Menu, 0, 64, 693, 416, 0, 0x0, 0 },
        { ICONVIEW_CreateIndirect, NULL, ID_ICONVIEW_Config, 50, 30, 693, 416, 0, 0x00640078, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/

// USER START (Optionally insert additional static code)
// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int NCode;
  int Id;
  // USER START (Optionally insert additional variables)
  // USER END

  switch (pMsg->MsgId) {
  case WM_PAINT:
                GUI_SetColor(0x00000000);
                GUI_FillRect(0, 0, 693, 416);
          break;
  case WM_INIT_DIALOG:
          hItem = pMsg->hWin;
          WINDOW_SetBkColor(hItem, 0x00000000);

                hICON = WM_GetDialogItem(pMsg->hWin,ID_ICONVIEW_Config);
                ICONVIEW_SetBkColor(hICON,ICONVIEW_CI_SEL,GUI_DARKGRAY);
                ICONVIEW_SetTextColor(hICON,ICONVIEW_CI_UNSEL,GUI_WHITE);
                ICONVIEW_SetTextColor(hICON,ICONVIEW_CI_SEL,0x00FF0000);
                ICONVIEW_SetBkColor(hICON,ICONVIEW_CI_BK,0x00000000);
                if(Language)
                        ;
                else
                        ICONVIEW_SetFont(hICON,&GUI_Font24B_ASCII);
                /*设置item之间的距离*/
                ICONVIEW_SetSpace(hICON,GUI_COORD_X,50);
                ICONVIEW_SetSpace(hICON,GUI_COORD_Y,50);
                ICONVIEW_AddStreamedBitmapItem(hICON,&_acicon_config,ButtonText[Language][8]);
                ICONVIEW_AddStreamedBitmapItem(hICON,&_acicon_config,ButtonText[Language][9]);
                ICONVIEW_AddStreamedBitmapItem(hICON,&_acicon_config,ButtonText[Language][10]);
                ICONVIEW_AddStreamedBitmapItem(hICON,&_acicon_config,ButtonText[Language][11]);
                ICONVIEW_AddStreamedBitmapItem(hICON,&_acicon_config,ButtonText[Language][12]);
                ICONVIEW_AddStreamedBitmapItem(hICON,&_acicon_config,ButtonText[Language][13]);
                //ICONVIEW_SetSel(hICON,Icon_sel++);
                WM_SetFocus(pMsg->hWin);
          // USER START (Optionally insert additional code for further widget initialization)
          // USER END
          break;
  case WM_NOTIFY_PARENT:
          Id = WM_GetId(pMsg->hWinSrc);
          NCode = pMsg->Data.v;
                GUI_RECT rect;
          switch (Id) {
          case ID_ICONVIEW_Config:
                  switch (NCode) {
                  case WM_NOTIFICATION_CLICKED:
                          // USER START (Optionally insert code for reacting on notification message)
                                printf("123");
                          // USER END
                          break;
                  case WM_NOTIFICATION_RELEASED:
                          // USER START (Optionally insert code for reacting on notification message)
                          // USER END
                          break;
                          // USER START (Optionally insert additional code for further notification handling)
                          // USER END
                  }
                  break;
                  // USER START (Optionally insert additional code for further Ids)
                // USER END
          }
          break;
       

  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateWindow
*/
WM_HWIN Create_MainActivity_Menu(WM_HWIN hParent);
WM_HWIN Create_MainActivity_Menu(WM_HWIN hParent) {
  WM_HWIN hWin;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, hParent, 0, 0);
  return hWin;
}

// USER START (Optionally insert additional public code)
// USER END

/*************************** End of file ****************************/


void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
        if(GPIO_Pin == USER_Btn_Pin)
        {
                HAL_Delay(20);
                if(HAL_GPIO_ReadPin(USER_Btn_GPIO_Port,USER_Btn_Pin) == GPIO_PIN_SET)
                {
                        ICONVIEW_SetSel(hICON,Icon_sel++);
                        if(Icon_sel >5)
                                Icon_sel = 0;
                }
        }
}


为什么我的iconview 轻触点击无效,一定要 长按n秒后再次点击才会 缓慢的更新 选中item,比我 用按键中断更新要慢。 有大佬能解决下吗

回复

使用道具 举报

发表于 2020-4-1 18:52:23 | 显示全部楼层
触摸检测用的是中断还是轮询?如果是中断的话,可以试试调整触摸中断的优先级。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-5-8 02:44 , Processed in 0.043332 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表