AnsweredAssumed Answered

Issue in handling Touch and waveform on window

Question asked by kulkarni.amit.001 on Nov 4, 2015
i am using STM32F4 discovery board with EMWIN. I have made a window which has
one button and one child window. If button is pressed then it should change its
bitmap image and on child window i am drawing w waveform point by point, by using a
function GUI_DrawPoint().
Issue is when waveform is being drawn, if i click on button, button doesn't changes its
bitmap & waveform drawing also stuck. But if i click on a button after waveform drawing
completes, button works and its bitmap gets changed. Below i have attached algorithm
of main.c and WindowDLG.c. Where can be the issue ? How to resolve it ?
  
  
  
  
MAIN.C
  
void waveform(WM_MESSAGE * pMsg) {                      //Handler for Child window
switch (pMsg->MsgId) {
     case WM_PAINT:      draw_waveform();
                         break;
      default:           WM_DefaultProc(pMsg);
                         break;
}
   
void draw_wvaeform()
{
     //using GUI_DrawPoint API to draw waveform
}
   
int main(void)
{
     /* Initialize system */
     /* Initialize LEDs */
      /* Initialize emWin */
       GUI_Clear();
        hWin = CreateWindow();                      //Creates a window with Button on it.
                 //Create child window for waveform
        hChild=WM_CreateWindowAsChild(2,36,205,194,hWin,WM_CF_SHOW,waveform,4);      
        GUI_Exec();
         while(1);
}
   
/* User handler for 1ms interrupts */
void TM_DELAY_1msHandler(void) {
      TM_EMWIN_UpdateTouch();
  
}
  
  
  
  
  
  
  
  
  
WINDOWDLG.C
  
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] =
{BUTTON_CreateIndirect, "", ID_BUTTON_0, 235, 116, 70, 30, 0, 0x0, 0 }
};
  
  
static void _cbDialog(WM_MESSAGE * pMsg) {
   
  
  
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
     
    // Initialization of "Button 0 with some bitmap image"
    
     
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by ''
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
          
        break;
      case WM_NOTIFICATION_RELEASED:
              hItem=pMsg->hWin;
              WM_SelectWindow(hItem);
              hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
              BUTTON_SetBitmap(hItem, 0, &change_bitmap);
           break;
        }
        break;
       }
    break;
  default:
    break;
  }
}
  
  
WM_HWIN CreateWindow(void);
WM_HWIN CreateWindow(void) {
  WM_HWIN hWin;
  
  
  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  return hWin;
}
 
 
              hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
              BUTTON_SetBitmap(hItem, 0, &change_bitmap);
           break;
        }
        break;
       }
    break;
  default:
    break;
  }
}

Outcomes