Ejemplo n.º 1
0
/**
 * Update EDIT boxes on LCD function
 */
static void lcd_update_values(WM_HWIN hWin_up)
{
	WM_HWIN hItem;
	char tbuff[16];
	static uint32_t ipaddr, hostip;

	if (ipaddr != ipcex_getGblVal(SHGBL_IPADDR)) {
		if (!ipaddr) lcd_create_infobox();
		ipaddr = ipcex_getGblVal(SHGBL_IPADDR);
		/* Set Host IP Address */
		hItem = WM_GetDialogItem(hWin_up, ID_EDIT_0);
		EDIT_SetTextAlign(hItem, GUI_TA_HCENTER);
		EDIT_SetBkColor(hItem, EDIT_CI_DISABLED, GUI_GREEN);
		EDIT_SetTextColor(hItem, EDIT_CI_DISABLED, GUI_GREEN);
		snprintf(tbuff, sizeof(tbuff) - 1, "%d.%d.%d.%d",
			ipaddr & 0xFF, (ipaddr >> 8) & 0xFF,
			(ipaddr >> 16) & 0xFF, (ipaddr >> 24) & 0xFF);
		EDIT_SetText(hItem, tbuff);
	}

	if (ipaddr && hostip != ipcex_getGblVal(SHGBL_HOSTADDR)) {
		hostip = ipcex_getGblVal(SHGBL_HOSTADDR);
		/* Set Remote IP address */
		hItem = WM_GetDialogItem(hWin_up, ID_EDIT_1);
		EDIT_SetTextAlign(hItem, GUI_TA_HCENTER);
		EDIT_SetBkColor(hItem, EDIT_CI_DISABLED, GUI_RED);
		EDIT_SetTextColor(hItem, EDIT_CI_DISABLED, GUI_RED);
		snprintf(tbuff, sizeof(tbuff)-1, "%d.%d.%d.%d",
			hostip & 0xFF, (hostip >> 8) & 0xFF,
			(hostip >> 16) & 0xFF, (hostip >> 24) & 0xFF);
		EDIT_SetText(hItem, tbuff);
	}
Ejemplo n.º 2
0
/**
  * @brief  Callback function of the File Control page
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbFileControl(WM_MESSAGE * pMsg)
{
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  int     result;  
  
  switch (pMsg->MsgId)
  {
  case WM_INIT_DIALOG:
    /* Initialization of 'Brightness' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER_CAPTION);
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER);
    EDIT_SetText(hItem, (char *)capture_folder);

    break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id)
    {
    case ID_BROWSE: /* Notifications sent by 'Radio' */
      switch(NCode)
      {
      case WM_NOTIFICATION_RELEASED:
        pFileInfo->pfGetData = k_GetData;
        pFileInfo->pMask = acMask_folder;
        BSP_SD_Init();
        SD_Configured = 1;
        
        chooser_select_folder = CHOOSEFILE_Create(CAMERA_hWin, 20, 20, 200, 150, apDrives, GUI_COUNTOF(apDrives), 0, "Select a folder", 0, pFileInfo);

        result = GUI_ExecCreatedDialog(chooser_select_folder);
        if (result == 0) 
        {  
          if(((pFileInfo->pRoot[0] == '0' ) || (pFileInfo->pRoot[0] == '1' )))
          {
            hItem = WM_GetDialogItem(hDialogFileControl, ID_FOLDER);
            EDIT_SetText(hItem, (char *)pFileInfo->pRoot);
            chooser_select_folder = 0;
            WM_InvalidateWindow(hDialogFileControl);
            WM_Paint(hDialogFileControl);
            strncpy((char *)(CAMERA_SAVE_PATH),pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE);
            strncpy((char *)capture_folder,pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE);
          }          
        }

        break;
      }
      break;
    }
    break;
    
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 3
0
/*********************************************************************
*
*       Dialog callback routine
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  int NCode, Id;
  WM_HWIN hEdit0, hEdit1, hEdit2, hEdit3, hListBox;
  WM_HWIN hWin = pMsg->hWin;
  switch (pMsg->MsgId) {
    case WM_INIT_DIALOG:
      /* Get window handles for all widgets */
      hEdit0   = WM_GetDialogItem(hWin, GUI_ID_EDIT0);
      hEdit1   = WM_GetDialogItem(hWin, GUI_ID_EDIT1);
      hEdit2   = WM_GetDialogItem(hWin, GUI_ID_EDIT2);
      hEdit3   = WM_GetDialogItem(hWin, GUI_ID_EDIT3);
      hListBox = WM_GetDialogItem(hWin, GUI_ID_LISTBOX0);
      /* Initialize all widgets */
      EDIT_SetText(hEdit0, "EDIT widget 0");
      EDIT_SetText(hEdit1, "EDIT widget 1");
      EDIT_SetTextAlign(hEdit1, GUI_TA_LEFT);
      EDIT_SetHexMode(hEdit2, 0x1234, 0, 0xffff);
      EDIT_SetBinMode(hEdit3, 0x1234, 0, 0xffff);
      LISTBOX_SetText(hListBox, _apListBox);
      SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
      break;
    case WM_KEY:
      switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) {
      case GUI_KEY_ESCAPE:
        GUI_EndDialog(hWin, 1);
        break;
      case GUI_KEY_ENTER:
        GUI_EndDialog(hWin, 0);
        break;
      }
      break;
    case WM_NOTIFY_PARENT:
      Id    = WM_GetId(pMsg->hWinSrc);    /* Id of widget */
      NCode = pMsg->Data.v;               /* Notification code */
      switch (NCode) {
        case WM_NOTIFICATION_RELEASED:    /* React only if released */
          if (Id == GUI_ID_OK) {          /* OK Button */
            GUI_EndDialog(hWin, 0);
          }
          if (Id == GUI_ID_CANCEL) {      /* Cancel Button */
            GUI_EndDialog(hWin, 1);
          }
          break;
        case WM_NOTIFICATION_SEL_CHANGED: /* Selection changed */
          FRAMEWIN_SetText(hWin, "Dialog - sel changed");
          break;
        default:
          FRAMEWIN_SetText(hWin, "Dialog - notification received");
      }
      break;
    default:
      WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 4
0
/*********************************************************************
*
*       Обновление статус панели
*/
void update_do_status_panel() {
  if (current_ekran.edition != 0) {
    char explanationText[100] = {0};
    unsigned int i = 0;
    for (; _rankDlgDOItem[0].pExplanation[sel_language][i] != '\0'; i++) {
      explanationText[i] = _rankDlgDOItem[0].pExplanation[sel_language][i];
    }
    _CONCAT_STR(explanationText, editModeAdditionalText[sel_language]);
    EDIT_SetText(hEdit, explanationText);
  } else {
    EDIT_SetText(hEdit, _rankDlgDOItem[0].pExplanation[sel_language]);
  }
}
Ejemplo n.º 5
0
void GUI_Refresh_AdvanceSetDLG(void)
{
    WM_HWIN hItem;
    u8 tmpBuf[16];

    
    hItem = WM_GetDialogItem(g_hWin_AdvanSet, ID_EDIT_0);
    sprintf(tmpBuf, "%d", g_rom_para.auto_sleep_time);
    EDIT_SetText(hItem, tmpBuf);
    
    hItem = WM_GetDialogItem(g_hWin_AdvanSet, ID_EDIT_1);
    sprintf(tmpBuf, "%d", g_rom_para.auto_shutdown_time);
    EDIT_SetText(hItem, tmpBuf);
}
Ejemplo n.º 6
0
/*********************************************************************
*
*       _GetFileName
*
* Purpose:
*   Returns the file name of the XBF file to be used
*/
static void _GetFileName(char * pPath, unsigned MaxSize) {
  WM_HWIN hWin;
  
  /* Set default value on first call */
  if (!strlen(pPath)) {
    strcpy(pPath, "Sample\\GUI\\FONT_ShowXBF\\ExtBinFont.xbf");
  }
  /* Display small hint */
  GUI_SetFont(&GUI_Font10_ASCII);
  GUI_DispStringHCenterAt("Please enter the file name of the XBF-file:", 160, 80);
  /* Create edit widget */
  hWin = EDIT_Create(10, 120, 300, 20, 0, MaxSize, WM_CF_SHOW);
  EDIT_SetText(hWin, pPath);
  WM_SetFocus(hWin);
  /* Wait until GUI_KEY_ENTER has been pressed */
  while (GUI_GetKey() != GUI_KEY_ENTER) {
    GUI_Delay(100);
  }
  /* Get filename from EDIT widget */
  EDIT_GetText(hWin, pPath, MaxSize);
  /* Create edit widget */
  WM_DeleteWindow(hWin);
  /* Clear screen */
  GUI_ClearRect(0, 40, 319, 239);
}
Ejemplo n.º 7
0
/*********************************************************************
*
*       _cbDialogOrder
*/
static void _cbDialogOrder(WM_MESSAGE* pMsg) {
  WM_HWIN hDlg, hWin = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    _InitDialogOrder(hWin);
    WM_SetFocus(WM_GetDialogItem(hWin, GUI_ID_OK));
    break;
  case WM_NOTIFY_PARENT:
    if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
      int Id = WM_GetId(pMsg->hWinSrc);
      switch (Id) {
      case GUI_ID_BUTTON0:
        hDlg = GUI_CreateDialogBox(_aDialogSelect, GUI_COUNTOF(_aDialogSelect), &_cbDialogSelect, WM_HBKWIN, 0, 0); 
        WM_MakeModal(hDlg);
        GUI_ExecCreatedDialog(hDlg);
        WM_MakeModal(hWin);
        WM_SetFocus(hWin);
        hDlg = WM_GetDialogItem(hWin, GUI_ID_EDIT0);
        EDIT_SetText(hDlg, _acVehicle);
        break;
      case GUI_ID_OK:
      case GUI_ID_CANCEL:
        GUI_EndDialog(hWin, 0);
        break;
      }
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 8
0
/*********************************************************************
*
*       _cbDialogUser
*
* Purpose:
*   Callback function of the user dialog.
*/
static void _cbDialogUser(WM_MESSAGE * pMsg) {
  int i, NCode, Id;
  WM_HWIN hDlg, hItem;
  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    for (i = 0; i < 2; i++) {
      hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0 + i);  /* Get the handle of the edit widget */
      EDIT_SetText(hItem, "12345678");                   /* Set text */
    }
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);      /* Id of widget */
    NCode = pMsg->Data.v;                 /* Notification code */
    switch (NCode) {
      case WM_NOTIFICATION_RELEASED:      /* React only if released */
        if (Id == GUI_ID_OK) {            /* OK Button */
          GUI_EndDialog(hDlg, 0);
        }
        if (Id == GUI_ID_CANCEL) {        /* Cancel Button */
          GUI_EndDialog(hDlg, 1);
        }
        break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 9
0
/*********************************************************************
*
*       GUI_EditString
*/
void GUI_EditString(char * pString, int Len, int xsize) {
  int Key, x, y, ysize, Id;
  EDIT_Handle hEdit;
  EDIT_Obj* pObj;
  const GUI_FONT GUI_UNI_PTR * pOldFont;
  WM_LOCK();
  pOldFont = GUI_SetFont(EDIT_GetDefaultFont());
  x = GUI_GetDispPosX();
  y = GUI_GetDispPosY();
  if (xsize == 0) {
    xsize = GUI_GetCharDistX('X') * Len + 6;
  }
  ysize = GUI_GetFontSizeY();
  Id = 0x1234;
  hEdit = EDIT_Create(x, y, xsize, ysize, Id, Len, 0);
  EDIT_SetText(hEdit, pString);
  pObj = EDIT_H2P(hEdit);
  WM_SetFocus(hEdit);
  do {
    Key = GUI_WaitKey();
  } while ((Key != GUI_KEY_ESCAPE) && (Key != GUI_KEY_ENTER) && (Key != 0));
  if (Key == GUI_KEY_ENTER) {
    EDIT_GetText(hEdit, pString, pObj->MaxLen);
  }
  GUI_SetFont(pOldFont);
  EDIT_Delete(hEdit);
  WM_UNLOCK();
}
Ejemplo n.º 10
0
void UseKeyBoard(WM_MESSAGE * pMsg,int id_lenth,int id_base,int id,EWorkState front_state)
{
	float mid;
	if(!keyboard_h.use_now)
	{
	keyboard_h.use_now = 1;
	keyboard_h.work_state = front_state;
		
	WidgetLock(pMsg->hWin,LOCK,id_lenth,id_base,id);
	KeyBoard_Win(&keyboard_h);
	WidgetLock(pMsg->hWin,UNLOCK,id_lenth,id_base,id);
	
	if(front_state == CHINESE){
	EDIT_SetFont(WM_GetDialogItem(pMsg->hWin, id), &GUI_FontHZ_SongTi_16);
		}
	else if((front_state == ENGLISH_S)||(front_state == ENGLISH_B)){
	EDIT_SetFont(WM_GetDialogItem(pMsg->hWin, id), &GUI_Font16_ASCII);
	}else if(front_state == SFLOAT){

	EDIT_SetFloatMode(WM_GetDialogItem(pMsg->hWin, id),0.0,-9000,9999,1,0);
	
	}
	if(front_state != SFLOAT)
	{
	EDIT_SetText(WM_GetDialogItem(pMsg->hWin, id), keyboard_h.res_ch_data_head);
	}else{
	
	EDIT_SetFloatValue(WM_GetDialogItem(pMsg->hWin, id),atof(keyboard_h.res_ch_data_head));
	}
	keyboard_h.use_now = 0;
	
	}
}
Ejemplo n.º 11
0
/*---------------------------------------------------------------------------*
 * Routine:     IKeyboardHandleEvent
 *---------------------------------------------------------------------------*
 * Description:
 *      Generic event handler.
 * Inputs:
 *      WM_MESSAGE *pMsg -- message structure for current dialog.
 *      int aNCode -- Type of event recived to process.
 *      int aID    -- not used.
 * Outputs:
 *      TBool -- EFalse is not problems, else ETrue.
 *---------------------------------------------------------------------------*/
static TBool IKeyboardHandleEvent(WM_MESSAGE * pMsg, int aNCode, int aID)
{
    TBool handled = EFalse;
    T_keyboardMapping *p = G_keypadCurrentMapping;
    WM_HWIN hItem;
    
    /* Find the code in the table */
    while (p->iID) {
        /* Is this the ID we want? */
        if (p->iID == aID) {
            if (aNCode == WM_NOTIFICATION_CLICKED) {
            } else if (aNCode == WM_NOTIFICATION_RELEASED){
                /* If this button has a special command, go process it */
                if (p->iCommand) {
                    /* Call the command associated with this ID */
                    handled = (p->iCommand)(pMsg, aNCode, aID);
                } else {
                    /* No command, do the standard code */
                    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOX);
                    if (G_textBoxIndex < G_maxKeys){
                        G_textBox[G_textBoxIndex] = p->iChar;
                        G_textBox[G_textBoxIndex + 1] = '\0';
                        G_textBoxIndex++;
                        EDIT_SetText(hItem, G_textBox);
                    }
                }
            }
            break;
        }
        p++;
    }  
    return handled;
}
Ejemplo n.º 12
0
void InitDialog_Cus(WM_MESSAGE * pMsg)
{
    WM_HWIN hWin = pMsg->hWin;
    //
    //GUI_ID_TEXT_USER
    //
    TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_USER),&GUI_FontHZ_SongTi_16);
	EDIT_SetFont(WM_GetDialogItem(hWin,GUI_ID_EDIT_USER),&GUI_FontHZ_SongTi_16);
	TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_MODLE),&GUI_FontHZ_SongTi_16);
	EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_USER),500);
    //
    //GUI_ID_TEXT_E_PROD
    //
    TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_E_PROD),&GUI_FontHZ_SongTi_16);
	EDIT_SetFont(WM_GetDialogItem(hWin,GUI_ID_EDIT_E_PROD),&GUI_FontHZ_SongTi_16);
	EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_E_PROD),500);
    //
    //GUI_ID_TEXT_MODLE
    //

	TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_L_PROD),&GUI_FontHZ_SongTi_16);
	EDIT_SetFont(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_PROD),&GUI_FontHZ_SongTi_16);
	EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_PROD),500);
    //
    //GUI_ID_TEXT0
    //
    TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT_L_MODE),&GUI_FontHZ_SongTi_16);
    //
    //
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_HOME),&GUI_FontHZ_SongTi_16);

	EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_MODE),500);
	EDIT_SetMaxLen(WM_GetDialogItem(hWin,GUI_ID_EDIT_MODLE),500);
    //
	EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_USER),custormer.custorm);
	
	EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_E_PROD),custormer.elevator_productor);

	EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_MODLE),custormer.series_no);
	
	EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_PROD),custormer.limitor_productor);
	
	EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_L_MODE),custormer.limitor_series);
	
}
Ejemplo n.º 13
0
/*---------------------------------------------------------------------------*
 * Routine:     IKeyboardHandleBack
 *---------------------------------------------------------------------------*
 * Description:
 *      Handles the backspace key, erase the last letter in the list.
 * Inputs:
 *      WM_MESSAGE *pMsg -- message structure for current dialog.
 *      int aNCode -- Type of event recived to process.
 *      int aID    -- not used.
 * Outputs:
 *      TBool -- EFalse is not problems, else ETrue.
 *---------------------------------------------------------------------------*/
static TBool IKeyboardHandleBack(WM_MESSAGE * pMsg, int aNCode, int aID)
{
    if(G_textBoxIndex){
        G_textBoxIndex--;
        G_textBox[G_textBoxIndex] = '\0';
        EDIT_SetText(WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOX), G_textBox); 
    }
    return EFalse;
}
Ejemplo n.º 14
0
/*---------------------------------------------------------------------------*
 * Routine:     _cbDialog
 *---------------------------------------------------------------------------*
 * Description:
 *      Callback function used by emWin to process events for the active window.
 * Inputs:
 *      WM_MESSAGE *pMsg -- message structure for current dialog.
 *---------------------------------------------------------------------------*/
static void _cbDialog(WM_MESSAGE * pMsg)
{
    WM_HWIN hItem;
    int Id, NCode;
    T_keyboardMapping *p = G_keypadCurrentMapping;

    switch (pMsg->MsgId) {
        case WM_INIT_DIALOG:
            //
            // Initialization of 'Window'
            //
            hItem = pMsg->hWin;
            G_window = hItem;
            WINDOW_SetBkColor(hItem, KEYBOARD_BACKGROUND_COLOR);
            //BUTTON_SetDefaultBkColor(KEY_BACKGROUND_COLOR, BUTTON_CI_UNPRESSED);
            EDIT_SetDefaultFont(&KEYBOARD_DEFAULT_FONT);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_BOX);
            EDIT_SetMaxLen(hItem, MAX_NUMBER_OF_CHARS);
            EDIT_SetText(hItem, G_textBox);
            EDIT_SetFont(hItem, &KEYBOARD_DEFAULT_FONT);
            G_textBoxIndex = EDIT_GetNumChars(hItem);
            hItem = WM_GetDialogItem(pMsg->hWin, ID_MESSAGE);
            TEXT_SetFont(hItem, &KEYBOARD_DEFAULT_FONT);
            TEXT_SetTextColor(hItem, GUI_BLACK);
            TEXT_SetBkColor(hItem, KEYBOARD_BACKGROUND_COLOR);
            TEXT_SetText(hItem, G_message);
            TEXT_SetTextAlign(hItem, GUI_TA_TOP);
            while (p->iID) {
                hItem = WM_GetDialogItem(pMsg->hWin, p->iID);
                BUTTON_SetFont(hItem, &KEYBOARD_DEFAULT_FONT);
                BUTTON_SetTextColor(hItem, BUTTON_CI_UNPRESSED, GUI_BLACK);
                BUTTON_SetTextColor(hItem, BUTTON_CI_PRESSED, GUI_BLACK);
                BUTTON_SetBkColor(hItem, BUTTON_CI_UNPRESSED,
                    KEY_BACKGROUND_COLOR);
                BUTTON_SetBkColor(hItem, BUTTON_CI_PRESSED, GUI_LIGHTGRAY);
                //BUTTON_SetSkin(hItem, BUTTON_SKIN_FLEX);
                p++;
            }
            WM_MakeModal(pMsg->hWin);
            setNewButtonText(pMsg, 0, 0);
            break;
        case WM_NOTIFY_PARENT:
            Id = WM_GetId(pMsg->hWinSrc);
            NCode = pMsg->Data.v;
            if (!IKeyboardHandleEvent(pMsg, NCode, Id)) {
                // Special cases go here
                // Nothing happens otherwise
            }
        case WM_POST_PAINT:
            // Make sure the all presses up til now are gone
            TouchscreenClearPresses();
            break;
        default:
            WM_DefaultProc(pMsg);
            break;
    }
}
Ejemplo n.º 15
0
/*******************************************************
*
*   超时,或者没有接收数据的时候,在edit框体中填充EE.EE
*
*********************************************************/
void RMD_ReadErr(void)
{
    WM_HWIN hItem;
    int i;
    for(i = 0;i < 5;i++)
    {
        hItem = WM_GetDialogItem(g_hWin_ReadMeter, (ID_EDIT_3 + i));
        EDIT_SetText(hItem, "EEEEEE.EE");
    }
}
Ejemplo n.º 16
0
void RMD_ClearData(void)
{
    WM_HWIN hItem;
    int i;
    for(i = 0;i < 5;i++)
    {
        hItem = WM_GetDialogItem(g_hWin_ReadMeter, (ID_EDIT_3 + i));
        EDIT_SetText(hItem, "0");
    }
}
static void ListWheel_SelChangeProc(WM_HWIN hWin, int lwId, int editId)
{
    int  lwItemIndex;
    char *lwBuf;
    WM_HWIN hItem;

    hItem = WM_GetDialogItem(hWin, lwId);
    lwItemIndex = LISTWHEEL_GetPos(hItem);
    LISTWHEEL_SetSel(hItem, lwItemIndex);
    lwBuf = mymalloc(SRAMIN, sizeof(char)*10);
    LISTWHEEL_GetItemText(hItem, lwItemIndex, lwBuf, 10);
    hItem = WM_GetDialogItem(hWin, editId);
    EDIT_SetText(hItem, lwBuf);
    myfree(SRAMIN, lwBuf);
}
Ejemplo n.º 18
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  EDIT_Handle hEdit;

  GUI_Init();
  WM_SetCallback(WM_HBKWIN, _cbBk);
  hEdit = EDIT_CreateEx(50, 110, 220, 25, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_EDIT0, TEXT_MAXLEN);
  WM_SetCallback(hEdit, _cbEdit);
  EDIT_SetText(hEdit, "Press <ENTER> when done...");
  EDIT_SetFont(hEdit, &GUI_Font8x16);
  EDIT_SetTextColor(hEdit, 0, GUI_RED);
  EDIT_EnableBlink(hEdit, 300, 1);
  while (1) {
    GUI_Delay(10);
  }
}
Ejemplo n.º 19
0
/*****************************
Peremaljovuvannja paneli resursu
*****************************/
void redraw_panel_resurs(void)
{
  EDIT_SetText(hEdit, _aBitmapItem[ICONVIEW_RES_COUNTER_ID].pExplanation[sel_language]);
  
  char string_tmp[10 + 1];
  unsigned int value_tmp;
  
  value_tmp = resurs_tmp;
  if (int_to_str (value_tmp, string_tmp))TEXT_SetText(Resurs_v[0], string_tmp);

  value_tmp = resurs_count_tmp;
  if (int_to_str (value_tmp, string_tmp))TEXT_SetText(Resurs_v[1], string_tmp);
  
  WM_HWIN FocussedWindow = (Resurs_FrameWin);
  WM_SetFocus(FocussedWindow);
}
Ejemplo n.º 20
0
/*********************************************************************
*
*       _GetVehicle
*/
static int _GetVehicle(WM_HWIN hWin) {
  WM_HWIN hItem;
  int CurSel, NumItems;
  hItem = WM_GetDialogItem(hWin, GUI_ID_LISTVIEW0);
  NumItems = LISTVIEW_GetNumRows(hItem);
  CurSel   = LISTVIEW_GetSel(hItem);
  if ((CurSel >= 0) && (CurSel < NumItems)) {
    strcpy(_acVehicle, _acItems[CurSel][0]);
    strcat(_acVehicle, " ");
    strcat(_acVehicle, _acItems[CurSel][1]);

    hItem = WM_GetDialogItem(hWin, GUI_ID_EDIT0);
    EDIT_SetText(hItem, _acVehicle);
    return 1;
  }
  return 0;
}
Ejemplo n.º 21
0
void OnxxxClicked_Lprod(WM_MESSAGE * pMsg)
{

	if(!keyboard_h.use_now)
	{
	keyboard_h.use_now = 1;
	keyboard_h.work_state = CHINESE;
		
	WidgetLock(pMsg->hWin,LOCK,10,GUI_ID_USER,GUI_ID_EDIT_L_PROD);
	KeyBoard_Win(&keyboard_h);
	WidgetLock(pMsg->hWin,UNLOCK,10,GUI_ID_USER,GUI_ID_EDIT_L_PROD);
	
	EDIT_SetFont(WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT_L_PROD), &GUI_FontHZ_SongTi_16);
	EDIT_SetText(WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT_L_PROD), keyboard_h.res_ch_data_head);
	keyboard_h.use_now = 0;
	
	}	
}
/*******************************************************************
*
*       _DemoEdit
*
  Edit a string until ESC or ENTER is pressed
*/
static void _DemoEdit(void) {
  EDIT_Handle hEdit;
  char aBuffer[28];
  int Key;
  GUI_SetBkColor(GUI_BLACK);
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_DispStringHCenterAt("WIDGET_Edit - Sample", 160, 5);
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringHCenterAt("Use keyboard to modify string...", 160, 90);
  /* Create edit widget */
  hEdit = EDIT_Create( 50, 110, 220, 25, ' ', sizeof(aBuffer), WM_CF_SHOW);
  /* Modify edit widget */
  EDIT_SetText(hEdit, "Press <ENTER> when done...");
  EDIT_SetFont(hEdit, &GUI_Font8x16);
  EDIT_SetTextColor(hEdit, 0, GUI_RED);
  /* Set keyboard focus to edit widget */
  WM_SetFocus(hEdit);
  /* Handle keyboard until ESC or ENTER is pressed */
  do {
    WM_Exec();
    Key = GUI_GetKey();
  } while ((Key != GUI_KEY_ENTER) && (Key != GUI_KEY_ESCAPE));
  /* Fetch result from edit widget */
  if (Key == GUI_KEY_ENTER) {
    EDIT_GetText(hEdit, aBuffer, sizeof(aBuffer));
  }
  /* Delete the edit widget */
  EDIT_Delete(hEdit);
  GUI_ClearRect(0, 50, 319, 239);
  /* Display the changed string */
  if (Key == GUI_KEY_ENTER) {
    GUI_Delay(250);
    GUI_DispStringHCenterAt("The string you have modified is:", 160, 90);
    GUI_DispStringHCenterAt(aBuffer, 160, 110);
    GUI_Delay(3000);
    GUI_ClearRect(0, 50, 319, 239);
  }
  GUI_Delay(500);
}
static void Edit_Update(WM_HWIN hWin, int editStartId, int editStopId, int lwId)
{
    int i,j;
    int lwItemIndex;
    char *str;
    LISTWHEEL_Handle hListWheel;
    WM_HWIN hItem;

    for(i=editStartId,j=lwId;i<=editStopId;i++,j++){
        hListWheel = WM_GetDialogItem(hWin, j);
        lwItemIndex = LISTWHEEL_GetPos(hListWheel);
        str = mymalloc(SRAMIN, sizeof(char)*10);
        if(str != NULL){
            *str = 0;
            LISTWHEEL_GetItemText(hListWheel, lwItemIndex, str, 10);
            hItem = WM_GetDialogItem(hWin, i);
            EDIT_SetText(hItem, str);
            myfree(SRAMIN, str);
        }
    }
}
Ejemplo n.º 24
0
/**
  * @brief  Callback function of the File Control page
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbFileControl(WM_MESSAGE * pMsg)
{
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  
  switch (pMsg->MsgId)
  {
  case WM_INIT_DIALOG:
    /* Initialization of 'Brightness' */
    hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER_CAPTION);
    TEXT_SetFont(hItem, GUI_FONT_13B_1);
    hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER);
    EDIT_SetText(hItem, (char *)capture_folder);

    break;
    
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id)
    {
    case ID_BROWSE: /* Notifications sent by 'Radio' */
      switch(NCode)
      {
      case WM_NOTIFICATION_RELEASED:
        pFileInfo->pfGetData = k_GetData;
        pFileInfo->pMask = acMask_folder;
        chooser_select_folder = CHOOSEFILE_Create(CAMERA_hWin, 67, 20, 385, 215, apDrives, GUI_COUNTOF(apDrives), 0, "Select a folder", 0, pFileInfo);
        break;
      }
      break;
    }
    break;
    
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
Ejemplo n.º 25
0
/*******************************************************************************************************
 *
 *         函数名称: 
 *
 *         函数功能: 
 *
 *         入口参数: 
 *
 *         出口参数: 无
 *
 *             说明:
 *
 *******************************************************************************************************/
void InitKBDlg(WM_MESSAGE * pMsg)
{
	int i;
    char  str_buff[10];
    
    
    WM_HWIN hWin = pMsg->hWin;

    FRAMEWIN_SetClientColor(hWin,RGB(185,205,232));

    BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),BUTTON_CI_UNPRESSED, RGB(70,77,106));
    BUTTON_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),BUTTON_CI_PRESSED, RGB(123,128,106));
    BUTTON_SetTextColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),BUTTON_CI_UNPRESSED,  GUI_WHITE);
    BUTTON_SetTextColor(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),BUTTON_CI_PRESSED,  GUI_WHITE);
    BUTTON_SetFont(WM_GetDialogItem(hWin,GUI_ID_BUTTON_NUM0),&GUI_Font16_ASCII);


    for (i = 2; i < 2 + 14; i++) //共14个按钮,在数组中的索引从2开始
    {
        BUTTON_SetBkColor(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),BUTTON_CI_UNPRESSED, RGB(70,77,106));
        BUTTON_SetBkColor(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),BUTTON_CI_PRESSED, RGB(123,128,106));
        BUTTON_SetTextColor(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),BUTTON_CI_UNPRESSED,  GUI_WHITE);
        BUTTON_SetTextColor(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),BUTTON_CI_PRESSED,  GUI_WHITE);
        BUTTON_SetFont(WM_GetDialogItem(hWin,_aTextDialogCreate[i].Id),&GUI_Font16_ASCII);

    }

    //GUI_ID_EDIT_KEYBOART
    //
    EDIT_SetTextAlign(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT), EDIT_CF_RIGHT|EDIT_CF_BOTTOM);
    EDIT_SetBkColor(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT), EDIT_CI_ENABLED,0xe7eaeb );
    EDIT_SetFont(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),&GUI_FontD32);
    EDIT_SetTextColor(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),0,GUI_RED);
    
    sprintf(str_buff,"%ld",ParentParam);
    EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),str_buff);
    
} 
Ejemplo n.º 26
0
/*****************************************************************
**
**		测量数据更新
**
**
*****************************************************************/
void MeasureDataUpdata (void) {
	/*单位转化-------------------------------------------------------*/
	//频率
	if (g_FPGAData.SignalFreq > 1000000) {//Mhz
		g_MeasureData.FreqUnit = _FreqUnit_MHz;
		g_FPGAData.SignalFreq /= 1000000.0;
	}
	else if (g_FPGAData.SignalFreq > 1000) { //Khz
		g_MeasureData.FreqUnit = _FreqUnit_KHz;
		g_FPGAData.SignalFreq /= 1000.0;
	}
	else {//Hz
		g_MeasureData.FreqUnit = _FreqUnit_Hz;
	}

	//幅度
	if (g_FPGAData.Amplitude > 1000) {//V
		g_MeasureData.AmlifUnit = _AmpliUnit_V;
		g_FPGAData.Amplitude /= 1000.0;
	}
	else {//mV
		g_MeasureData.AmlifUnit = _AmpliUnit_mV;
	}

	/*转化数据为字符串-------------------------------------------------------*/
	sprintf(g_MeasureData.FreqData, "%g", g_FPGAData.SignalFreq);
	sprintf(g_MeasureData.AmlifData, "%g", g_FPGAData.Amplitude);
	sprintf(g_MeasureData.DutyData, "%g", g_FPGAData.DutyCycle);

	/*显示数据-------------------------------------------------------*/
	EDIT_SetText(g_MeasureData.FreqHandle, g_MeasureData.FreqData);
	EDIT_SetText(g_MeasureData.DutyHandle, g_MeasureData.DutyData);
	EDIT_SetText(g_MeasureData.AmlifHandle, g_MeasureData.AmlifData);

	/*显示单位-------------------------------------------------------*/
	EDIT_SetText(g_MeasureData.FreqUnitHandle, g_MeasureData.FreqUnit);
	EDIT_SetText(g_MeasureData.DutyUnitHandle, g_MeasureData.DutyUnit);
	EDIT_SetText(g_MeasureData.AmlifUnitHandle, g_MeasureData.AmlifUnit);
}
Ejemplo n.º 27
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  int     SelNum;
  int     i;

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Listbox'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0);
    for(i = 0;i < 6;i++)
    {
        LISTBOX_AddString(hItem, pTextPreamble[i]);
    }
    switch(g_rom_para.preamble)
    {
        case 0xFC:
            LISTBOX_SetSel(hItem,0);
            break;
        case 0xFA:
            LISTBOX_SetSel(hItem,1);
            break;
        case 0xFB:
            LISTBOX_SetSel(hItem,2);
            break;
        case 0xFD:
            LISTBOX_SetSel(hItem,3);
            break;
        case 0xFF:
            LISTBOX_SetSel(hItem,4);
            break;
        case 0xFE:
            LISTBOX_SetSel(hItem,5);
            break;
    }
    //
    // Initialization of 'Listbox'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_1);
    for(i = 0;i < 7;i++)
    {
        LISTBOX_AddString(hItem, pTextSpeed[i]);
    }
    switch(g_rom_para.plc_freq)
    {
        case PLC_270_III:
            LISTBOX_SetSel(hItem,0);
            break;
        case PLC_270_III_5:
            LISTBOX_SetSel(hItem,1);
            break;
        case PLC_270_II:
            LISTBOX_SetSel(hItem,2);
            break;
        case PLC_421_50BPS:
            LISTBOX_SetSel(hItem,3);
            break;
        case PLC_421_100BPS:
            LISTBOX_SetSel(hItem,4);
            break;
        case PLC_421_600BPS:
            LISTBOX_SetSel(hItem,5);
            break;
        case PLC_421_1200BPS:
            LISTBOX_SetSel(hItem,6);
            break;
    
    }

    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
    BUTTON_SetBkColor(hItem,0,GUI_GREEN);

    hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
    WIDGET_AndState(hItem,WIDGET_STATE_FOCUSSABLE);
    BUTTON_SetBkColor(hItem,0,GUI_YELLOW);

    break;
    
  case WM_KEY:
    if((((WM_KEY_INFO *)(pMsg->Data.p))->PressedCnt) == 1)
    {   
        switch(((WM_KEY_INFO *)(pMsg->Data.p))->Key)
        {
            case GUI_KEY_GREEN:
                if(g_rom_para.channel != CHANNEL_PLC)
                {
                    ERR_NOTE(g_hWin_monitor,GUI_MSBOX_FUN_DISALE_ERROR);
                }
                else
                {
                    if(g_hWin_ReadMeter > 0)
                    {
                        hItem = WM_GetDialogItem(pMsg->hWin,ID_LISTBOX_0);
                        SelNum = LISTBOX_GetSel(hItem);
                        if(SelNum != 5) //前导符不是FE
                        {
                            hItem = RMD_Get_Speed();
                            EDIT_SetText(hItem,pTextPreamble[SelNum]);
                        }
                        else if(SelNum == 5)
                        {
                            hItem = WM_GetDialogItem(pMsg->hWin,ID_LISTBOX_1);
                            SelNum = LISTBOX_GetSel(hItem);
                            hItem = RMD_Get_Speed();
                            EDIT_SetText(hItem,pTextSpeed[SelNum]);
                        }
                    }
                    else if(g_hWin_ProtoDbg > 0)
                    {
                        hItem = WM_GetDialogItem(pMsg->hWin,ID_LISTBOX_0);
                        SelNum = LISTBOX_GetSel(hItem);
                        if(SelNum != 5) //前导符不是FE
                        {
                            hItem = CPT_Get_Speed();
                            EDIT_SetText(hItem,pTextPreamble[SelNum]);
                        }
                        else if(SelNum == 5)
                        {
                            hItem = WM_GetDialogItem(pMsg->hWin,ID_LISTBOX_1);
                            SelNum = LISTBOX_GetSel(hItem);
                            hItem = CPT_Get_Speed();
                            EDIT_SetText(hItem,pTextSpeed[SelNum]);
                        }
                    }
                    else if(g_hWin_para > 0)
                    {
                        //保留
                    }
                    FRQ_PreamSel(pMsg);
                    if(0xFE == g_rom_para.preamble)
                    {
                        FRQ_FreqSel(pMsg);
                        g_gui_para.cmd = GUI_CMD_PLC_FREQ_SET;
                        g_gui_para.state = GUI_STATE_PLC_FREQ_SET;
                        OSMboxPost(g_sys_ctrl.up_mbox, (void*)&g_gui_para);
                    }
                    DEV_Parameters_Write();//保存数据
                    
                    WM_DeleteWindow(g_hWin_freq);
                    FRQ_SetFocus();
                    g_hWin_freq = HBWIN_NULL;
                }
                break;

            case GUI_KEY_YELLOW:
                WM_DeleteWindow(g_hWin_freq);
                FRQ_SetFocus();
                g_hWin_freq = HBWIN_NULL;
                break;
        }
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
/*********************************************************************
*
*       _cbDialog
*
* Function description
*   Callback routine of dialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  static WM_HWIN   hCellEdit = 0;
  CELL_EDIT_ORG    CellEditOrg;
  WM_KEY_INFO    * pKeyInfo;
  GUI_RECT         ItemRect;
  WM_HWIN          hDlg;
  WM_HWIN          hItem;
  char             acItemText[LEN_ITEM_TEXT];
  int              CheckState;
  int              NCode;
  int              Id;
  int              i;

  hDlg = pMsg->hWin;
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Set listview properties
    //
    hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
    WM_SetCallback(hItem, _cbList);
    HEADER_SetDragLimit(LISTVIEW_GetHeader(hItem), 1);
    LISTVIEW_SetAutoScrollV(hItem, 1);
    LISTVIEW_SetGridVis(hItem, 1);
    LISTVIEW_SetRBorder(hItem, 5);
    LISTVIEW_SetLBorder(hItem, 5);
    for (i = 0; i < 3; i++) {
      LISTVIEW_AddColumn(hItem, _aColProps[i].Width, _aColProps[i].pText, _aColProps[i].Align);
      LISTVIEW_SetCompareFunc(hItem, i, _aColProps[i].fpCompare);
    }
    LISTVIEW_EnableSort(hItem);
    for (i = 0; i < 6; i++) {
      if (_AddRow(hItem, 1)) {
        break;
      }
    }
    //
    // Set radio button text
    //
    hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO0);
    RADIO_SetText(hItem, "Sorted",   0);
    RADIO_SetText(hItem, "Unsorted", 1);
    //
    // Init checkbox text
    //
    hItem = WM_GetDialogItem(hDlg, GUI_ID_CHECK0);
    CHECKBOX_SetTextAlign(hItem, GUI_TA_LEFT);
    CHECKBOX_SetText(hItem, "Cell select");
    break;
  case WM_KEY:
    hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
    if (pMsg->hWinSrc == hItem) {
      pKeyInfo = (WM_KEY_INFO *)pMsg->Data.p;
      if (pKeyInfo->PressedCnt == 0) {
        if (pKeyInfo->Key == GUI_KEY_ENTER) {
          if (hCellEdit == 0) {
            CellEditOrg.Row = LISTVIEW_GetSel(hItem);
            CellEditOrg.Col = LISTVIEW_GetSelCol(hItem);
            LISTVIEW_GetItemRect(hItem, CellEditOrg.Col, CellEditOrg.Row, &ItemRect);
            LISTVIEW_GetItemTextSorted(hItem, CellEditOrg.Col, CellEditOrg.Row, acItemText, LEN_ITEM_TEXT);
            hCellEdit = EDIT_CreateUser(ItemRect.x0, ItemRect.y0, ItemRect.x1 - ItemRect.x0 + 2, ItemRect.y1 - ItemRect.y0 + 1, hItem, WM_CF_SHOW, 0, 0, LEN_ITEM_TEXT, sizeof(CELL_EDIT_ORG));
            EDIT_SetUserData(hCellEdit, &CellEditOrg, sizeof(CELL_EDIT_ORG));
            WIDGET_SetEffect(hCellEdit, &WIDGET_Effect_Simple);
            WM_SetCallback(hCellEdit, _cbCellEdit);
            WM_SetFocus(hCellEdit);
            EDIT_SetText(hCellEdit, acItemText);
          }
        }
      }
    }
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch (NCode) {
    case WM_NOTIFICATION_CHILD_DELETED:
      if (pMsg->hWinSrc == hCellEdit) {
        hCellEdit = 0;
      }
      break;
    case WM_NOTIFICATION_VALUE_CHANGED:
      switch (Id) {
      case GUI_ID_RADIO0:
        //
        // Enable/Disable sorting
        //
        hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        switch (RADIO_GetValue(WM_GetDialogItem(hDlg, GUI_ID_RADIO0))) {
        case 0:
          LISTVIEW_EnableSort(hItem);
          break;
        default:
          LISTVIEW_DisableSort(hItem);
          break;
        }
        break;
      }
      break;
    case WM_NOTIFICATION_RELEASED:
      switch (Id) {
      case GUI_ID_BUTTON0:
        //
        // Add new row
        //
        hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        _AddRow(hItem, 0);
        break;
      case GUI_ID_BUTTON1:
        //
        // Insert new row
        //
        hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        i     = LISTVIEW_GetSelUnsorted(hItem);
        _AddRow(hItem, 1);
        if (i >= 0) {
          LISTVIEW_SetSelUnsorted(hItem, i + 1);
        }
        break;
      case GUI_ID_BUTTON2:
        //
        // Delete row
        //
        hItem = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        i     = LISTVIEW_GetSelUnsorted(hItem);
        LISTVIEW_DeleteRow(hItem, (i >= 0) ? i : 0);
        break;
      case GUI_ID_OK:
        //
        // End dialog
        //
        GUI_EndDialog(hDlg, 0);
        break;
      case GUI_ID_CHECK0:
        //
        // Enable/Disable cell selection
        //
        hItem      = WM_GetDialogItem(hDlg, GUI_ID_CHECK0);
        CheckState = CHECKBOX_GetState(hItem);
        hItem      = WM_GetDialogItem(hDlg, GUI_ID_LISTVIEW0);
        if (CheckState) {
          LISTVIEW_EnableCellSelect(hItem, 1);
        } else {
          LISTVIEW_EnableCellSelect(hItem, 0);
        }
        break;
      }
      break;
    }
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
Ejemplo n.º 29
0
/*******************************************************************************************************
 *
 *         函数名称: 
 *
 *         函数功能: 
 *
 *         入口参数: 
 *
 *         出口参数: 无
 *
 *             说明:
 *
 *******************************************************************************************************/
void _cbKBDlgCallback1(WM_MESSAGE * pMsg) 
{
    int NCode;
    int id;
    int i;
    
    char str_buff[10];
      
    WM_HWIN hWin = pMsg->hWin;
    
    switch (pMsg->MsgId) 
    {
        case WM_PAINT:
            //TextNumPaintDialog(pMsg);
            break;        
        case WM_INIT_DIALOG:
            InitKBDlg(pMsg);
            break;        
        case WM_KEY:
            break;            
        case WM_NOTIFY_PARENT:
            id = WM_GetId(pMsg->hWinSrc); 
            NCode = pMsg->Data.v;        
            switch (NCode) 
            {
				case WM_NOTIFICATION_RELEASED:
                    switch (id)
                    {                
                        case GUI_ID_OK:
                            GUI_EndDialog(hWindKB, 0);
                            break;
                        case GUI_ID_CANCEL:
                            GUI_EndDialog(hWindKB, 0);
                        
                            break;
                    }  
                    break;  
                                 
                case WM_NOTIFICATION_CLICKED:
                    switch(id)
                    {  
                        case GUI_ID_BUTTON_CLR:  //清除
                            EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),"0");
                            break;
                        case GUI_ID_BUTTON_BK_SPC: //退格
                            WM_SetFocus(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT));
                            GUI_SendKeyMsg(GUI_KEY_BACKSPACE,1);
                            break;
                        case GUI_ID_BUTTON_OK:
                            EDIT_AddKey(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),'\0');
                            EDIT_GetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),str_buff,sizeof(str_buff));
                            GUI_EndDialog(hWin, atoi(str_buff));
                            break;
                        case GUI_ID_BUTTON_CANCEL:
                            GUI_EndDialog(hWin, -1);
                            break;
                        default:
                            for (i = 0; i < 10; i++) //10个数字
                            {
                                if (NumBtn09ID[i] == id)
                                {
                                    EDIT_AddKey(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),'0' + i);
                                    break;             
                                }
                            }                             
                          
                   } 
                   break;
               }
               
               break;
               
         default:
            WM_DefaultProc(pMsg);      
    }      
          
        
    
}
Ejemplo n.º 30
0
/*******************************************************************************************************
 *
 *         函数名称: 
 *
 *         函数功能: 
 *
 *         入口参数: 
 *
 *         出口参数: 无
 *
 *             说明:
 *
 *******************************************************************************************************/
void _cbKBDlgCallback(WM_MESSAGE * pMsg) 
{
    int NCode;
    int id;
    int i;
    ///static  U32 input_num ;
    WM_MESSAGE Msg = {0};
    
    char str_buff[10];
      
    WM_HWIN hWin = pMsg->hWin;
    
    switch (pMsg->MsgId) 
    {
        case WM_CREATE:
            break;
        case WM_PAINT:
            //TextNumPaintDialog(pMsg);
            break;        
        case WM_INIT_DIALOG:
            InitKBDlg(pMsg);
            break;        
        case WM_KEY:
            switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) 
            {
                case GUI_KEY_ESCAPE:
                    GUI_EndDialog(pMsg->hWin, 1);
                    break;
                case GUI_KEY_ENTER:
                    GUI_EndDialog(pMsg->hWin, 0);
                    break;
            }
            break;
            
         case WM_NOTIFY_PARENT:
            id = WM_GetId(pMsg->hWinSrc); 
            NCode = pMsg->Data.v;        
            switch (NCode) 
            {
				case WM_NOTIFICATION_RELEASED:
                    switch (id)
                    {                
                        case GUI_ID_OK:
                            GUI_EndDialog(hWin, 0);
                  
                            break;
                        case GUI_ID_CANCEL:
                            GUI_EndDialog(hWin, 0);
                            break;
                        case GUI_ID_BUTTON_OK:
                            GUI_EndDialog(hWin, ParentParam);
                            Msg.MsgId   = WM_USER_SFKB_END;
                            Msg.Data.v  = BCD2UINT16(ParentParam);
                            Msg.hWin    = hMain;      
                            Msg.hWinSrc = hWin;

                            WM_SendMessage(hMain, &Msg);
                            break;
                        case GUI_ID_BUTTON_CANCEL:
                            GUI_EndDialog(hWin, -1);
                       
                            break;
                        default:
                            break;
                    }  
                    break;                    
                case WM_NOTIFICATION_CLICKED:
                    switch(id)
                    {  
                        case GUI_ID_BUTTON_CLR:  //清除
                            ParentParam = 0;
                            goto update_edit;
                        case GUI_ID_BUTTON_BK_SPC: //退格
                            ParentParam = ParentParam >> 4;
                            goto update_edit;
                        case GUI_ID_BUTTON_OK:
                            //GUI_EndDialog(hWin, input_num);
                            break;
                        case GUI_ID_BUTTON_CANCEL:
                            //GUI_EndDialog(hWin, -1);
                            break;
                        case GUI_ID_BUTTON_NUM1:
                        case GUI_ID_BUTTON_NUM2:
                        case GUI_ID_BUTTON_NUM3:
                        case GUI_ID_BUTTON_NUM4:
                        case GUI_ID_BUTTON_NUM5:
                        case GUI_ID_BUTTON_NUM6:
                        case GUI_ID_BUTTON_NUM7:
                        case GUI_ID_BUTTON_NUM8:
                        case GUI_ID_BUTTON_NUM9:
                        case GUI_ID_BUTTON_NUM0:    
                            for (i = 0; i < 10; i++) //10个数字
                            {
                                if (NumBtn09ID[i] == id)
                                {
                                    ParentParam = (ParentParam << 4) + i; 
                                    break;             
                                }
                            } 
                            
                            ParentParam &= 0xFFFFF;
                            
                          update_edit:
                            sprintf(str_buff,"%x",ParentParam);
                            EDIT_SetText(WM_GetDialogItem(hWin,GUI_ID_EDIT_KB_INPUT),str_buff);
                            break;
                         default:
                             break;
                   } 
                   break;
               }
               
               break;
               
         default:
            WM_DefaultProc(pMsg);      
    }      
          
        
    
}