예제 #1
0
void OnButtonClicked_Next(WM_MESSAGE * pMsg)
{

	if(h_pars == NULL)
	{
	EDIT_GetText(WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT_USER), custormer.custorm, sizeof(custormer.custorm));
	EDIT_GetText(WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT_E_PROD), custormer.elevator_productor, sizeof(custormer.elevator_productor));
	EDIT_GetText(WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT_MODLE), custormer.series_no, sizeof(custormer.series_no));
	EDIT_GetText(WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT_L_PROD), custormer.limitor_productor, sizeof(custormer.limitor_productor));
	EDIT_GetText(WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT_L_MODE), custormer.limitor_series, sizeof(custormer.limitor_series));
	if(hlimit_speed_tlimit_speed == 0)
	{
	parameter(pMsg);
	}else{
	tparameter(pMsg);
	}

	}else{
	if(hlimit_speed_tlimit_speed == 0)
	{
	 LimitSpeedH(pMsg);
	}else{
//	 LimitSpeedT(pMsg);
	}
	}

}
예제 #2
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();
}
/*********************************************************************
*
*       _cbCellEdit
*
* Function description
*   Callback function of the EDIT widget which is created above a
*   LISTVIEW cell.
*/
static void _cbCellEdit(WM_MESSAGE * pMsg) {
  CELL_EDIT_ORG   CellEditOrg;
  WM_KEY_INFO   * pKeyInfo;
  WM_HWIN         hList;
  char            acText[LEN_ITEM_TEXT];

  switch (pMsg->MsgId) {
  case WM_KEY:
    pKeyInfo = (WM_KEY_INFO *)pMsg->Data.p;
    if (pKeyInfo->PressedCnt == 0) {
      if (pKeyInfo->Key == GUI_KEY_ENTER) {
        WM_SetFocus(WM_GetParent(pMsg->hWin));
        WM_DeleteWindow(pMsg->hWin);
        break;
      }
    }
    EDIT_Callback(pMsg);
    break;
  case WM_SET_FOCUS:
    if (pMsg->Data.v == 0) {
      WM_DeleteWindow(pMsg->hWin);
    } else {
      EDIT_Callback(pMsg);
    }
    break;
  case WM_DELETE:
    EDIT_GetUserData(pMsg->hWin, &CellEditOrg, sizeof(CELL_EDIT_ORG));
    hList = WM_GetParent(pMsg->hWin);
    EDIT_GetText(pMsg->hWin, acText, LEN_ITEM_TEXT);
    LISTVIEW_SetItemTextSorted(hList, CellEditOrg.Col, CellEditOrg.Row, acText);
    break;
  default:
    EDIT_Callback(pMsg);
  }
}
예제 #4
0
static u8 RMD_Get_Para(WM_MESSAGE *pMsg)
{   
    WM_HWIN hItem;
    u8  i;
    u8  dropdown_selnum;
    u8 rmd[GUI_645_ADDR_LENGTH+2];
 
    hItem=WM_GetDialogItem(pMsg->hWin,ID_EDIT_0);
    EDIT_GetText(hItem, rmd, GUI_645_ADDR_LENGTH+1);

    if(strlen(rmd) != GUI_645_ADDR_LENGTH)
    {
        //error proc
        //GUI_MessageBox()
        //MESSAGEBOX_Create("dst addr error!", "error", 0);
        //EDIT_SetText(hItem, "11111");
        //ERROR_BOX(GUI_MSBOX_ADDR_ERROR);
        return DEV_ERROR;
    }

    if(DEV_OK != GUI_GetMeterAddr(rmd, g_gui_para.dstAddr))
    {
        return DEV_ERROR;
    }
    
    g_gui_para.ctrlCode = c_645ctrlDef[g_rom_para.protocol][DL645_CTRL_READ_DATA]; 

    g_gui_para.dataLen = 0;

    g_gui_para.cmd = GUI_CMD_MRW;
    
    return DEV_OK;

}
예제 #5
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);
}
예제 #6
0
LONG CuEditableListCtrlCommentInsertValue::OnEditDlgOK (UINT wParam, LONG lParam)
{
	int iItem, iSubItem;
	CString s = EDIT_GetText();
	EDIT_GetEditItem(iItem, iSubItem);
	if (iItem < 0)
	{
		SetFocus();
		return 0L;
	}
	try
	{
		SetItemText (iItem, iSubItem, s);
		GetParent()->SendMessage (WM_LAYOUTEDITDLG_OK, (WPARAM)(LPCTSTR)m_EditDlgOriginalText, (LPARAM)(LPCTSTR)s);
	}
	catch (...)
	{
		//CString strMsg = _T("Cannot change edit text.");
		AfxMessageBox (IDS_E_CHANGE_EDIT);
	}

	SetFocus();
	return 0L;

}
예제 #7
0
LONG CuEditableListCtrlGeneric::OnEditDlgOK (UINT wParam, LONG lParam)
{
	int iItem, iSubItem;
	CString s = EDIT_GetText();
	EDIT_GetEditItem(iItem, iSubItem);
	if (iItem < 0)
		return 0L;

	try
	{
		GENERICLINEINFO* pData = (GENERICLINEINFO*)GetItemData (iItem);
		if (pData)
		{
			CString strOldName = pData->szname;
			if (GetGenericForCache())
			{
				//
				// Special care of cache management.
				VCBFllCachePaneOnEdit (pData, (LPTSTR)(LPCTSTR)s);
			}
			else
			{
				VCBFllGenPaneOnEdit(pData, (LPTSTR)(LPCTSTR)s);
			}
			ASSERT (strOldName == pData->szname);
			VCBF_GenericSetItem (this, pData, iItem);
		}
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuEditableListCtrlGeneric::OnEditDlgOK has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
	return 0L;
}
/*******************************************************************
*
*       _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);
}
예제 #9
0
LONG CuEditableListCtrlGenericDerived::OnEditDlgOK (UINT wParam, LONG lParam)
{
	int iItem, iSubItem;
	CString s = EDIT_GetText();
	EDIT_GetEditItem(iItem, iSubItem);
	if (iItem < 0)
		return 0L;

	try
	{
		DERIVEDLINEINFO* pData = (DERIVEDLINEINFO*)GetItemData (iItem);
		if (pData)
		{
			CString strOldName = pData->szname;
		
			BOOL bOk = VCBBllOnEditDependent(pData, (LPTSTR)(LPCTSTR)s);
			ASSERT (strOldName == pData->szname);
			VCBF_GenericDerivedAddItem (this, (LPCTSTR)strOldName, GetGenericForCache());
		}
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuEditableListCtrlGenericDerived::OnEditDlgOK has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
	return 0L;
}
예제 #10
0
/*********************************************************************
*
*       _cbBk
*/
static void _cbBk(WM_MESSAGE * pMsg) {
  static WM_HWIN hEdit    = 0;
  static U8      ShowText = 0;
  char           aBuffer[TEXT_MAXLEN];

  switch (pMsg->MsgId) {
  case WM_PAINT:
    GUI_SetBkColor(GUI_DARKGRAY);
    GUI_Clear();
    GUI_SetFont(&GUI_Font24_ASCII);
    GUI_DispStringHCenterAt("WIDGET_Edit - Sample", 160, 5);
    GUI_SetFont(&GUI_Font8x16);
    if (ShowText) {
      GUI_DispStringHCenterAt("The string you have modified is:", 160, 90);
      EDIT_GetText(hEdit, aBuffer, TEXT_MAXLEN);
      GUI_DispStringHCenterAt(aBuffer, 160, 110);
    } else {
      GUI_DispStringHCenterAt("Use keyboard to modify string...", 160, 90);
    }
    break;
  case WM_APP_SHOW_TEXT:
    if (hEdit == 0) {
      hEdit = pMsg->hWinSrc;
    }
    WM_HideWindow(hEdit);
    ShowText = 1;
    WM_InvalidateWindow(WM_HBKWIN);
    WM_CreateTimer(WM_HBKWIN, 0, 3000, 0);
    break;
  case WM_TIMER:
    ShowText = 0;
    WM_InvalidateWindow(WM_HBKWIN);
    WM_ShowWindow(hEdit);
    break;
  default:
    WM_DefaultProc(pMsg);
  }
}
예제 #11
0
/*********************************************************************
*
*       _cbCallback
*/
static void _cbCallback(WM_MESSAGE * pMsg) {
  int     NCode;
  int     Id;
  int     Sel;
  char    ac[80];
  WM_HWIN hDlg;
  WM_HWIN hMulti;
  WM_HWIN hItem;

  hDlg   = pMsg->hWin;
  hMulti = WM_GetDialogItem(hDlg, GUI_ID_MULTIEDIT0);
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0);
    SLIDER_SetRange(hItem, 1, 100);
    SLIDER_SetValue(hItem, 100);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER1);
    SLIDER_SetRange(hItem, 1, 152);
    SLIDER_SetValue(hItem, 152);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER2);
    SLIDER_SetRange(hItem, 0, 5);
    SLIDER_SetValue(hItem, 2);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_SLIDER3);
    SLIDER_SetRange(hItem, 0, 100);
    SLIDER_SetValue(hItem, 0);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT1);
    EDIT_SetDecMode(hItem, 0, 0, 1000, 0, 0);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO2);
    RADIO_SetText(hItem, "None", 0);
    RADIO_SetText(hItem, "Char", 1);
    RADIO_SetText(hItem, "Word", 2);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_RADIO3);
    RADIO_SetText(hItem, "None",   0);
    RADIO_SetText(hItem, "Simple", 1);
    RADIO_SetText(hItem, "3D",     2);
    RADIO_SetValue(hItem, 2);
    RADIO_SetTextColor(hItem, GUI_BLUE);
    MULTIEDIT_EnableBlink(hMulti, 300, 1);
    MULTIEDIT_SetFont(hMulti, &GUI_Font8x16);
    MULTIEDIT_SetBkColor(hMulti, 0, GUI_YELLOW);
    MULTIEDIT_SetTextColor(hMulti, 0, GUI_BLUE);
    MULTIEDIT_SetAutoScrollV(hMulti, 1);
    MULTIEDIT_SetInsertMode(hMulti, 1);
    MULTIEDIT_SetPrompt(hMulti, "C:\\>");
    MULTIEDIT_SetHBorder(hMulti, 2);
    MULTIEDIT_SetText(hMulti, "Multiedit - long line 12345678901234567890\nThis demonstrates the use of a MULTIEDIT widget");
    MULTIEDIT_AddKey(hMulti, 'A');
    MULTIEDIT_AddKey(hMulti, 'B');
    MULTIEDIT_AddKey(hMulti, 'C');
    MULTIEDIT_AddKey(hMulti, GUI_KEY_ENTER);
    MULTIEDIT_SetAutoScrollH(hMulti, 1);
    hItem = WM_GetDialogItem(hDlg, GUI_ID_BUTTON5);
    BUTTON_SetFocussable(hItem, 0);
    break;
  case WM_KEY:
    switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) {
    case GUI_KEY_ESCAPE:
      GUI_EndDialog(hDlg, 1);
      break;
    case GUI_KEY_ENTER:
      GUI_EndDialog(hDlg, 0);
      break;
    }
    break;
  case WM_NOTIFY_PARENT:
    Id     = WM_GetId(pMsg->hWinSrc);
    NCode  = pMsg->Data.v;
    hItem  = WM_GetDialogItem(hDlg, Id);
    switch (NCode) {
    case WM_NOTIFICATION_VALUE_CHANGED:
      switch (Id) {
      case GUI_ID_SLIDER0:
        Sel = SLIDER_GetValue(hItem);
        WM_SetYSize(hMulti, Sel);
        break;
      case GUI_ID_SLIDER1:
        Sel = SLIDER_GetValue(hItem);
        WM_SetXSize(hMulti, Sel);
        break;
      case GUI_ID_SLIDER2:
        Sel = SLIDER_GetValue(hItem);
        MULTIEDIT_SetHBorder(hMulti, Sel);
        break;
      case GUI_ID_SLIDER3:
        Sel = SLIDER_GetValue(hItem);
        MULTIEDIT_SetMaxNumChars(hMulti, Sel);
        break;
      case GUI_ID_RADIO0:
        //
        // Horizontal scrollbar
        //
        Sel = RADIO_GetValue(hItem);
        switch (Sel) {
        case 0:
          MULTIEDIT_SetAutoScrollH(hMulti, 1);           // Auto
          break;
        case 1:
          MULTIEDIT_SetAutoScrollH(hMulti, 0);           // Off
          WM_SetScrollbarH(hMulti, 0);
          break;
        case 2:
          MULTIEDIT_SetAutoScrollH(hMulti, 0);           // On
          WM_SetScrollbarH(hMulti, 1);
          break;
        }
        break;
      case GUI_ID_RADIO1:
        //
        // Vertical scrollbar
        //
        Sel = RADIO_GetValue(hItem);
        switch (Sel) {
        case 0:
          MULTIEDIT_SetAutoScrollV(hMulti, 1);
          break;
        case 1:
          MULTIEDIT_SetAutoScrollV(hMulti, 0);
          WM_SetScrollbarV(hMulti, 0);
          break;
        case 2:
          MULTIEDIT_SetAutoScrollV(hMulti, 0);
          WM_SetScrollbarV(hMulti, 1);
          break;
        }
        break;
      case GUI_ID_RADIO2:
        //
        // Wrap
        //
        Sel = RADIO_GetValue(hItem);
        switch (Sel) {
        case 0:
          MULTIEDIT_SetWrapNone(hMulti);
          break;
        case 1:
          MULTIEDIT_SetWrapChar(hMulti);
          break;
        case 2:
          MULTIEDIT_SetWrapWord(hMulti);
          break;
        }
        break;
      case GUI_ID_RADIO3:
        //
        // Effect type
        //
        Sel = RADIO_GetValue(hItem);
        switch (Sel) {
        case 0:
          WIDGET_SetEffect(hMulti, &WIDGET_Effect_None);
          break;
        case 1:
          WIDGET_SetEffect(hMulti, &WIDGET_Effect_Simple);
          break;
        case 2:
          WIDGET_SetEffect(hMulti, &WIDGET_Effect_3D);
          break;
        }
        break;
      }
      break;
      case WM_NOTIFICATION_RELEASED:      // React only if released
        WM_GetDialogItem(hDlg, Id);
        switch (Id) {
        case GUI_ID_OK:
          GUI_EndDialog(hDlg, 0);
          break;
        case GUI_ID_CANCEL:
          GUI_EndDialog(hDlg, 1);
          break;
        case GUI_ID_CHECK0:
          _RdOnly ^= 1;
          MULTIEDIT_SetReadOnly(hMulti, _RdOnly);
          break;
        case GUI_ID_CHECK1:
          _RTF8 ^= 1;
          if (_RTF8) {
            GUI_UC_SetEncodeUTF8();
          } else {
            GUI_UC_SetEncodeNone();
          }
          WM_InvalidateWindow(hMulti);
          break;
        case GUI_ID_CHECK2:
          _Password ^= 1;
          MULTIEDIT_SetPasswordMode(hMulti, _Password);
          break;
        case GUI_ID_BUTTON1:
          hItem  = WM_GetDialogItem(hDlg, GUI_ID_EDIT0);
          EDIT_GetText(hItem, &ac[0], sizeof(ac));
          MULTIEDIT_SetPrompt(hMulti, ac);
          break;
        case GUI_ID_BUTTON2:
          hItem  = WM_GetDialogItem(hDlg, GUI_ID_EDIT1);
          MULTIEDIT_SetCursorOffset(hMulti, EDIT_GetValue(hItem));
          WM_SetFocus(hMulti);
          break;
        case GUI_ID_BUTTON3:
          MULTIEDIT_SetText(hMulti, "Short text");
          break;
        case GUI_ID_BUTTON4:
          MULTIEDIT_SetText(hMulti, "Long text\n123456789012345678901234567890\nLast line\n");
          break;
        case GUI_ID_BUTTON5:
          MULTIEDIT_AddText(hMulti, "Added");
          break;
        case GUI_ID_BUTTON6:
          MULTIEDIT_SetFont(hMulti, &GUI_Font8x16);
          break;
        case GUI_ID_BUTTON7:
          MULTIEDIT_SetFont(hMulti, &GUI_Font16_1);
          break;
        }
        break;
    }
    break;
    default:
      WM_DefaultProc(pMsg);
  }
}
예제 #12
0
LONG CuEditableListCtrlComponent::OnEditDlgOK (UINT wParam, LONG lParam)
{
	int iItem, iSubItem;
	CString s = EDIT_GetText();
	EDIT_GetEditItem(iItem, iSubItem);
	if (iItem < 0) {
	  MessageBeep(MB_ICONEXCLAMATION);
			return 0L;
	}
	
	// optimization: if text not changed or if text empty, behave as if cancelled
	if (s.IsEmpty())
	  return 0L;
	if (s == m_EditDlgOriginalText)
	  return 0L;

  // Emb Oct 22, 97: don't accept underscore in name
  if (s.Find(_T('_')) != -1) {
    AfxMessageBox(IDS_ERR_UNDERSCORE);
  	SetItemText (iItem, iSubItem, m_EditDlgOriginalText);
    return 0L;    // As if not changed
  }

  // Emb Oct 22, 97: must check whether another item has the same name
  int count = GetItemCount();
  CuCbfListViewItem* pCurItemData = (CuCbfListViewItem*)GetItemData(iItem);
	LPCOMPONENTINFO lpCurComponentInfo = &pCurItemData->m_componentInfo;
  for (int cpt = 0; cpt < count; cpt++) {
    // exclude current item
    if (cpt == iItem)
      continue;

    // get component info of item
    CuCbfListViewItem* pItem = (CuCbfListViewItem*)GetItemData(cpt);
	  LPCOMPONENTINFO lpItemInfo = &pItem->m_componentInfo;

    // compare types
    if (lpItemInfo->itype != lpCurComponentInfo->itype)
      continue;

    // compare names - INSENSIVIVE
    if (s.CompareNoCase((LPCTSTR)lpItemInfo->szname) != 0)
      continue;

    // same type and name : denied
    AfxMessageBox(IDS_ERR_DUPLICATE_NAME);
  	SetItemText (iItem, iSubItem, m_EditDlgOriginalText);
    return 0L;    // As if not changed
  }

	// Emb Sept 25, 97: preliminary test at low level side
	CuCbfListViewItem* pItemData = (CuCbfListViewItem*)GetItemData(iItem);
	LPCOMPONENTINFO lpComponentInfo = &pItemData->m_componentInfo;
	AfxGetApp()->DoWaitCursor(1);
	try
	{
		BOOL bSuccess = VCBFllValidRename(lpComponentInfo, (LPTSTR)(LPCTSTR)s);
		AfxGetApp()->DoWaitCursor(-1);
		if (!bSuccess)
			MessageBeep(MB_ICONEXCLAMATION);
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuEditableListCtrlComponent::OnEditDlgOK has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
	// always display text as returned in the structure by VCBFllValidRename()
	SetItemText (iItem, iSubItem, (LPCTSTR)lpComponentInfo->szname);

	return 0L;
}
예제 #13
0
파일: SoftKBDlg.c 프로젝트: meterhu/stm32F4
/*******************************************************************************************************
 *
 *         函数名称: 
 *
 *         函数功能: 
 *
 *         入口参数: 
 *
 *         出口参数: 无
 *
 *             说明:
 *
 *******************************************************************************************************/
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);      
    }      
          
        
    
}
void Edit_Get_Text(WM_HWIN hWin, int editId, char *str)
{
    WM_HWIN hItem;
    hItem = WM_GetDialogItem(hWin, editId);
    EDIT_GetText(hItem, str, EDIT_GetNumChars(hItem)+1);
}
예제 #15
0
int egx_edit_get_text_(egx_wnd_t hwnd,char *text,int length)
{
	WM_HWIN hWnd = GUIWND_TO_HWND(hwnd);	
	EDIT_GetText(hWnd,text,length);
	return 0;
}
예제 #16
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN                hItem;

	int cursorpos=0;
  int index=0;
	uint8_t res=0;
	uint8_t sel=0;
	char str[60];
	uint8_t filename[110];
  uint8_t NumChars=0;
	hItem = pMsg->hWin;
	WINDOW_SetBkColor(hItem, GUI_LIGHTGRAY);
	
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetFont(hItem,&GUI_FontHZ_Song_16);
		TEXT_SetTextAlign(hItem, TEXT_CF_HCENTER | TEXT_CF_VCENTER);
    TEXT_SetText(hItem, (char *)"保存自学习文件");  
	
	  hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
    TEXT_SetFont(hItem,&GUI_FontHZ_Song_16);
		TEXT_SetText(hItem, (char *)"文件名称:"); 
		
	
		hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
    TEXT_SetFont(hItem,&GUI_FontHZ_Song_16);
		TEXT_SetText(hItem, (char *)"文件类型:WTR"); 
	
		hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3);
    TEXT_SetFont(hItem,&GUI_FontHZ_Song_16);
		TEXT_SetText(hItem, (char *)"保存路径:"); 
	
	  hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0);
		DROPDOWN_SetFont(hItem,&GUI_FontHZ_Song_16);
    DROPDOWN_AddString(hItem, (char *)"U盘");
    DROPDOWN_AddString(hItem, (char *)"SD卡");
		if(k_StorageGetStatus(MSD_DISK_UNIT) != 0)
		DROPDOWN_SetSel(hItem,1);
		else DROPDOWN_SetSel(hItem,0);
	
		hItemwarn = WM_GetDialogItem(pMsg->hWin, ID_TEXT_WARNING);
    TEXT_SetFont(hItemwarn,&GUI_FontHZ_Song_12);
		TEXT_SetTextColor(hItemwarn,GUI_RED);
		TEXT_SetText(hItemwarn, (char *)"警告:文件名不能为空!");
		WM_HideWindow(hItemwarn);
	
		hIteminfo = WM_GetDialogItem(pMsg->hWin, ID_TEXT_INFO);
    TEXT_SetFont(hIteminfo,&GUI_FontHZ_Song_12);
		TEXT_SetTextColor(hIteminfo,GUI_RED);
		TEXT_SetText(hIteminfo, (char *)"文件保存成功!");
		WM_HideWindow(hIteminfo);
		
		
		hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_TILEPATH);
		//EDIT_SetDecMode(hItem, 24, 1,256, 0, 0);
		EDIT_SetFont(hItem,GUI_FONT_32_1);
		EDIT_SetMaxLen(hItem, 50);
		EDIT_EnableBlink(hItem, 600, 1);
		EDIT_SetInsertMode(hItem,1);
		//strcpy ((char*)str,(char *)path_studyfile);
		//strcat ((char*)str,"/");
		//strcat ((char*)str,"A.wtr");
    EDIT_SetText(hItem,"A");
		cursorindex=EDIT_GetCursorCharPos(hItem);
		WM_SetFocus(hItem);
    
		hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OK);
		BUTTON_SetFont(hItem,&GUI_FontHZ_Song_12);
		BUTTON_SetSkinClassic(hItem);
		BUTTON_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
		BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED, GUI_GREEN);
		BUTTON_SetFocussable(hItem,0);//不接收焦点
		
		hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CANCEL);
		BUTTON_SetFont(hItem,&GUI_FontHZ_Song_12);
		BUTTON_SetSkinClassic(hItem);
		BUTTON_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
		BUTTON_SetBkColor(hItem,BUTTON_CI_UNPRESSED, GUI_RED);
		BUTTON_SetFocussable(hItem,0);//不接收焦点
		
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
	case WM_KEY:
		//GUI_SendKeyMsg(GUI_KEY_TAB, 1);//改变输入焦点
	
		break;
	case MY_MESSAGE_CLICK:
		GUI_SendKeyMsg(GUI_KEY_TAB, 1);//改变输入焦点
		break;
	case MY_MESSAGE_OK:
		hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_TILEPATH);
		if(EDIT_GetNumChars(hItem)==0)
		{
			hItemwarn = WM_GetDialogItem(pMsg->hWin, ID_TEXT_WARNING);
			WM_ShowWindow(hItemwarn);
			break;
		}
		else 
		{
			hItemwarn = WM_GetDialogItem(pMsg->hWin, ID_TEXT_WARNING);
			WM_HideWindow(hItemwarn);		
		}
		hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0);
		store_dev=DROPDOWN_GetSel(hItem);
		
		hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_TILEPATH);
		EDIT_GetText(hItem, str, 51);
		if(store_dev == 0)//usb
		{
			if(sizeof(path_studyfile) < 50) strcpy ((char*)filename,(char *)path_studyfile);
			else														strcpy ((char*)filename,(char *)path_Default);
		}
		if(store_dev == 1)//sd
		{
			if(sizeof(path_studyfile) < 50) strcpy ((char*)filename,(char *)path_studyfile_sd);
			else														strcpy ((char*)filename,(char *)path_Default_sd);
		}
		strcat ((char*)filename,"/");
		strcat ((char*)filename,str);
		strcat ((char*)filename,".wtr");
		hIteminfo = WM_GetDialogItem(pMsg->hWin, ID_TEXT_INFO);
		TEXT_SetText(hIteminfo, "正在保存自学习文件!");
		WM_ShowWindow(hIteminfo);
		GUI_Exec();
		res=WT_StudyFiles_Write(filename);//0-ok, 1-hardware error, 2-file operate error, 
		if(res==0)
		{
			hIteminfo = WM_GetDialogItem(pMsg->hWin, ID_TEXT_INFO);
			TEXT_SetText(hIteminfo, (char *)"文件保存成功!");
			WM_ShowWindow(hIteminfo);
		}
		else
		{
			hIteminfo = WM_GetDialogItem(pMsg->hWin, ID_TEXT_INFO);
			TEXT_SetText(hIteminfo, "警告:保存失败,未检测到存储设备!");
			WM_ShowWindow(hIteminfo);
			break;
		}

		GUI_EndDialog(pMsg->hWin,0);

		break;
	case MY_MESSAGE_DOWN://向右移动光标
		hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0);
		if(WM_HasFocus(hItem))//选择存储路径
		{
			sel=DROPDOWN_GetSel(hItem);
			if(sel<1)
			{
				DROPDOWN_IncSel(hItem);
			}					
			else //sel>=2 
			{
				DROPDOWN_SetSel(hItem,0);		
			}						
		}
		hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_TILEPATH);	
		cursorpos=EDIT_GetCursorCharPos(hItem);
		NumChars = EDIT_GetNumChars(hItem);
		if(cursorpos <= (NumChars-1) )
		{
			EDIT_SetCursorAtChar(hItem,cursorpos+1);
			EDIT_SetSel(hItem,cursorpos+1,cursorpos+1);
			cursorindex=EDIT_GetCursorCharPos(hItem);
		}
		//KeyLed_State.wheel=0;
		break;
	case MY_MESSAGE_UP://向左移动光标
		hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_TILEPATH);
		cursorpos=EDIT_GetCursorCharPos(hItem);
		EDIT_SetCursorAtChar(hItem,cursorpos-1);
		EDIT_SetSel(hItem,cursorpos-1,cursorpos-1);
		cursorindex=EDIT_GetCursorCharPos(hItem);
		break;
	case	MY_MESSAGE_WHEEL://处理滚轮事件
		hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_TILEPATH);
		EDIT_SetCursorAtChar(hItem,cursorindex);
		index=KeyLed_State.wheel;

		if(KeyLed_State.wheel>=65 && KeyLed_State.wheel <130) index=KeyLed_State.wheel-65;
		if(KeyLed_State.wheel>=130 && KeyLed_State.wheel <195) index=KeyLed_State.wheel-130;
		if(KeyLed_State.wheel>=195) index=64;
		if(KeyLed_State.wheel<0 && KeyLed_State.wheel >= -65) index=KeyLed_State.wheel+65;
		if(KeyLed_State.wheel<-65 && KeyLed_State.wheel >= -130) index=KeyLed_State.wheel+130;
		if(KeyLed_State.wheel<-130) index=0;
		if(cursorindex==EDIT_GetCursorCharPos(hItem))
		{
			EDIT_AddKey(hItem,GUI_KEY_DELETE);
			EDIT_AddKey(hItem,input_char[index]);
			cursorpos=EDIT_GetCursorCharPos(hItem);
			EDIT_SetSel(hItem,cursorpos-1,cursorpos-1);
		}

		break;
	case MY_MESSAGE_BUTTONDELETE://删除字符
		hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_TILEPATH);
		if(WM_HasFocus(hItem))
		{
			EDIT_AddKey(hItem,GUI_KEY_BACKSPACE);
			cursorindex=EDIT_GetCursorCharPos(hItem);
		}
		break;
	case WM_PAINT://绘制标题栏
		GUI_SetColor(GUI_DARKBLUE);
		GUI_FillRect(0,0,480,22);
		GUI_SetColor(GUI_DARKGRAY);
		GUI_SetPenSize(6);
		GUI_DrawRect(0,0,480-2,222-2);
    break;
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}