Beispiel #1
0
//--------------------------------------------------------------------------
//	功能:插入字符串
//--------------------------------------------------------------------------
int KWndEdit::InsertString(const char* pString, int nLen)
{
	int bInserted = false;
	if (m_Flag & WNDEDIT_ES_WIN32_WND)
	{
		bInserted = Win32Edit_InsertString(m_hWin32Wnd, pString, nLen);
	}
	else if (pString)
	{
		int bEnableChinese = (m_Flag & WNDEDIT_ES_IME_AVAILABLE);
		if (nLen < 0)
			nLen = strlen(pString);
		for (int nPos = 0; nPos < nLen; nPos++)
		{
			if ((unsigned char)(pString[nPos]) <= 0x80)
			{
				if (InsertChar(pString[nPos]))
					bInserted = true;
			}
			else if (nPos + 1 < nLen)
			{
				if (bEnableChinese && InsertChar(pString[nPos + 1], pString[nPos]))
					bInserted = true;
				nPos ++;
			}
		}
		if (bInserted)
			FmtForShow();
	}
	return bInserted;
}
void InputMemberData(NODE** pNode){
	MEMBER * Member = (MEMBER *)malloc(sizeof(MEMBER));
	(*pNode)->pData = Member;
	InsertChar("회원 이름 : ", &((MEMBER*)((*pNode)->pData))->pName);
	InsertInt("회원 나이 : ",&((MEMBER*)((*pNode)->pData))->pAge);
	InsertChar("회원 전화번호 : ", &((MEMBER*)((*pNode)->pData))->pPhone);
}
Beispiel #3
0
void Sted::Handle (Event& e) {
    if (e.eventType == KeyEvent) {
        if (e.len != 0) {
            char c = e.keystring[0];

            switch (c) {
            case '\010':
            case '\177':
                if (editor->Dot() != editor->Mark()) {
                    editor->DeleteSelection();
                } else {
                    editor->DeleteText(-1);
                }
                break;
            case '\015':
                InsertChar('\n');
                break;
            default:
                if (!iscntrl(c)) {
                    InsertChar(c);
                }
                break;
            }
        }
    } else if (e.eventType == DownEvent) {
        GetRelative(e.x, e.y, editor);
        editor->Select(editor->Locate(e.x, e.y));
        do {
            editor->ScrollToView(e.x, e.y);
            editor->SelectMore(editor->Locate(e.x, e.y));
            Poll(e);
            GetRelative(e.x, e.y, editor);
        } while (e.leftmouse);
    }
}
void InputMemberData_Server(MEMBER* pMember)
{
	InsertChar("ȸ¿ø ID : ", &(pMember->pMemberID));
	InsertChar("ȸ¿ø PassWord : "******"ȸ¿ø À̸§ : ", &(pMember->pName));
	InsertInt("ȸ¿ø ³ªÀÌ : ", &(pMember->pAge));
	InsertChar("ȸ¿ø ÀüÈ­¹øÈ£ : ", &(pMember->pPhone));

}
Beispiel #5
0
//returns -1 if not handled, otherwise returns position one-past-the-end of inserted text
UInt32 TextInputMessageBox::ResolveControlCode(UInt8 controlCode, UInt32 insertPos)
{
	if (controlCode == DIK_RETURN)
		return InsertChar(insertPos, '\n');
	else
		return -1;
}
WMSG_RESULT CUISpinControl::OnCharMessage( MSG* pMsg )
{
	extern UBYTE	_abKeysPressed[256];

	// If editbox is not focused
	if( !IsFocused() || m_InValidEditBox )
		return WMSG_FAIL;

	if(m_bOnlyInteger && (pMsg->wParam < 48 || pMsg->wParam > 57))
	{
		return WMSG_SUCCESS;
	}

	InsertChar(m_nCursorIndex, pMsg->wParam);

	if (_atoi64(GetString()) > m_llMax)
	{
		CTString strTmp;
		strTmp.PrintF("%I64d", m_llMax);

		SetString(strTmp.str_String);
	}

	return WMSG_SUCCESS;
}
void InputVideoData(VIDEO * pVideo){

	InsertInt("ºñµð¿À ¹øÈ£ : ", &(pVideo->iVNumber));
	InsertChar("ºñµð¿À À̸§ : ", &(pVideo->pVName));
	InsertInt("ºñµð¿À µî±Þ : ", &(pVideo->iGrade));
	pVideo->bRent = true;
	pVideo->bReservation = false;
}
Beispiel #8
0
void KeyPress(int key, int mx, int my)
{
	int newchar;
	int oldlen;
	if (key == K_ESCAPE)
	{
		Menu_Control(0);
		Cvar_SetString("name", (char*)namebuffer);
	}
	else if (key == K_MOUSE1)
	{
		mx -= ((640 - (480-16))/2);
		my -= 16;
		mx /= (480-16)/16;
		my /= (480-16)/16;

		newchar = (int)mx + (int)my * 16;

		InsertChar(newchar);
	}
	else if (key == K_MOUSE2 || key == K_BACKSPACE)
	{
		if (insertpos > 0)
			insertpos--;
		for (oldlen = insertpos; namebuffer[oldlen]; oldlen++)
			namebuffer[oldlen] = namebuffer[oldlen+1];
	}
	else if (key == K_LEFTARROW)
	{
		insertpos--;
		if (insertpos < 0)
			insertpos = 0;
	}
	else if (key == K_RIGHTARROW)
	{
		insertpos++;
		if (insertpos > strlen(namebuffer))
			insertpos = strlen(namebuffer);
	}
	else if (key == K_SHIFT)
		return;
	else if (key > 0 && key < 255)
		InsertChar(key);
}
Beispiel #9
0
int EBuffer::InsPrevLineChar() {
    int L = VToR(CP.Row);
    int C = CP.Col, P;

    if (L > 0) {
        L--;
        if (C < LineLen(L)) {
            P = CharOffset(RLine(L), C);
            return InsertChar(RLine(L)->Chars[P]);
        }
    }
    return 0;
}
Beispiel #10
0
bool cgUILineEdit::OnChar( unsigned wparam, unsigned lparam )
{
	if(!IsPrintableWord(wparam)) return false;

	ClearSel();// 清空选中项

	if (!InsertChar(wparam))
		return false;
	
	ReportUIEvent(cgUIEvent_OnTextChange);

	return true;
}
Beispiel #11
0
char* InsertBrace4PlusMinus(char* str)
{
	char* cp = str;
	int start = FindRepeatedPlusMinus(str);
	char temp[BUF_MAX] = { 0, };
	int idx = 0;
	int cont = 0;

	zStrcpy(temp, str);

	while ( temp[idx] != '+' && temp[idx] != '-' )
	{
		cont++;
		idx++;
	}
	if (cont < start)
	{
		// ) 치는 곳 뒤에 +- 연속되는 곳이 있다. 너무 많은 것을 ( ) 싸는 것은 한계가 있는 것 같고 우선 대충 너무 많이 +- 중복되는 것은 미리 걸러주고 시작해야할듯;
	}
	cont = 0;
	start = start + idx;
	InsertChar(temp, '(', start);
	// 다음숫자가 나오는곳 다음칸에 ) 를 넣기
	while ( !zIsDigit(temp[idx]) )
	{		
		idx++;
	}
	while ( zIsDigit(temp[idx]) )
	{
		idx++;
	}
	start = idx;
	InsertChar(temp, ')', start);
	zStrcpy(cp, temp);
	return cp;
}
Beispiel #12
0
void PG_MaskEdit::SetText(const std::string& new_text) {
	PG_LineEdit::SetText(my_displaymask);

	// set the displaymask if the string is empty
	if(new_text.empty()) {
		return;
	}

	SetCursorPos(0);

	// merge the text with the displaymask
	for(Uint32 i=0; i<new_text.length(); i++) {
		InsertChar(new_text[i]);
	}
}
Beispiel #13
0
int HoldKeyPressing(TextEdition *te, SDL_Event event)
{
    char c, done=1;
    if (event.type != SDL_KEYDOWN || !te->focus || HasReadOnlyStyle(te->style))
        return 0;

    switch(event.key.keysym.sym)
    {
        case SDLK_DELETE:
            if (te->selection.begin == te->selection.end)
                DeleteChar(te->text, te->cursorPos);
            else DeleteSelection(te);
            TE_UpdateTextEdition(te, 0);
            break;
        case SDLK_BACKSPACE:
            if (te->selection.begin == te->selection.end)
            {
                if (te->cursorPos > 0)
                    DeleteChar(te->text, -- te->cursorPos);
            }
            else DeleteSelection(te);
            TE_UpdateTextEdition(te, 0);
            break;
        case SDLK_RETURN:
        case SDLK_KP_ENTER:
            event.key.keysym.unicode = '\n';
        default:
            if (event.key.keysym.unicode)
            {
                if (event.key.keysym.unicode<256)
                    c = event.key.keysym.unicode;
                else c = '?';

                if (te->selection.begin != te->selection.end)
                    DeleteSelection(te);
                InsertChar(te->text, te->cursorPos, c, te->textLength);
                TE_UpdateTextEdition(te, 0);
                te->cursorPos++;
            }
            else done = 0;

            break;
    }

    return done;
}
Beispiel #14
0
bool cgUILineEdit::Insert( LPCTSTR lpctStr )
{
	if (!lpctStr )
	{
		return false;
	}

	TCHAR ch = 0;
	while (ch=*lpctStr++)
	{
		if (IsPrintableWord(ch))
			InsertChar(ch);
	}

	ReportUIEvent(cgUIEvent_OnTextChange);
	ReportDirty();

	return true;

}
bool CGenericSerialConsole::ProcessChar ( const uint8_t c )
{
  // When the user inserts characters at the command's beginning,
  // a number of bytes are sent to the terminal, depending on the command length.

  bool isCmdReady = false;

  switch ( c )
  {
  case 0x1B: // Escape
    m_state = stEscapeReceived;
    break;

    // When you press the ENTER key, most terminal emulators send either a single LF or the (CR, LF) sequence.
  case 0x0A: // LF, \n
  case 0x0D: // Enter pressed (CR, \r)
    isCmdReady = true;
    break;

  case 0x02: // ^B (left arrow)
    LeftArrow();
    break;

  case 0x06: // ^F (right arrow)
    RightArrow();
    break;

  case 0x08: // Backspace (^H).
  case 0x7F: // For me, that's the backspace key.
    Backspace();
    break;

  default:
    InsertChar( c );
    break;
  }

  return isCmdReady;
}
void InputVideoData(NODE** pNode){
	int switch_on = 0;
	VIDEO* Video = (VIDEO*)malloc(sizeof(VIDEO));
	(*pNode)->pData = Video;
	InsertInt("비디오 번호 : ", &((VIDEO*)((*pNode)->pData))->iVNumber);
	InsertChar("비디오 이름 : ", &((VIDEO*)((*pNode)->pData))->pVName);
	InsertInt("비디오 등급 : ", &((VIDEO*)((*pNode)->pData))->iGrade);
	printf("1.대여 가능, 2.대여 불가 \n");
	scanf_s("%d", &switch_on);
	fflush(stdin);
	switch (switch_on)
	{
	case 1:
		printf("대여 가능\n");
		((VIDEO*)((*pNode)->pData))->bRent = true;
		break;
	default:
		printf("대여중 \n");
		((VIDEO*)((*pNode)->pData))->bRent = false;
		break;
	}
}
Beispiel #17
0
void LogCompStr::AddChar(WCHAR chTyped, WCHAR chTranslated, DWORD dwConv) {
  FOOTMARK();
  size_t size0 = comp_str.size();
  WCHAR ch = PrevCharInClause();
  if (ch) ch = dakuon_shori(ch, chTranslated);
  if (ch) {
    chTyped = '@';
    chTranslated = ch;
    AddDakuonChar(chTyped, chTranslated, dwConv);
  } else if (!CompCharInClause(dwCursorPos, extra.iClause, TRUE)) {
    AddCharToEnd(chTyped, chTranslated, dwConv);
  } else {
    InsertChar(chTyped, chTranslated, dwConv);
  }
  size_t size1 = comp_str.size();
  DWORD ich = ClauseToCompChar(extra.iClause);
  if (size0 < size1) {
    std::vector<BYTE> addition(size1 - size0);
    comp_attr.insert(comp_attr.begin() + ich, addition.begin(), addition.end());
  } else if (size1 < size0) {
    comp_attr.erase(comp_attr.begin() + ich,
                    comp_attr.begin() + ich + DWORD(size0 - size1));
  }
} // LogCompStr::AddChar
Beispiel #18
0
HTMLEventStatus WebEditBox::Event (HTMLEvent *e)
{
    WEBC_DEBUG_ReceiveEvent(this, e);
	switch (e->type)
	{
#if (WEBC_SUPPORT_TOUCHSCREEN)
		case HTML_EVENT_MOUSEDOWN:
			if (!(mFlags & DISPLAY_FLAG_DISABLED))
			{
				PopUpKeyPad((HTMLBrowser *)webc_GetBrowserWithFocus(), this->miNumLines, (void *) this, GetText(), EditBoxKeyboardcloseFn);
				return (HTML_EVENT_STATUS_DONE);
			}

//		case HTML_EVENT_MOUSEDOWN:
//		GetText();
#endif
		case HTML_EVENT_KEYDOWN:
			if (!(mFlags & DISPLAY_FLAG_DISABLED))
			{
				switch (e->data.key)
				{
					case WGK_PGUP:
					case WGK_PGDN:
					case WGK_HOME:
					case WGK_END:
					case WGK_LNUP:
					case WGK_LNDN:
					{
						WEBC_BOOL selecting = 0;
						if (e->flags & HTML_EVENT_FLAG_SHIFT_DOWN)
						{
							selecting = 1;
							BeginSelect();
						}
						switch (e->data.key)
						{
							case WGK_PGUP:
								break;

							case WGK_PGDN:
								break;

							case WGK_HOME:
								if (e->flags & HTML_EVENT_FLAG_CTRL_DOWN)
								{
									Home();
								}
								else
								{
									LineHome();
								}
								break;

							case WGK_END:
								if (e->flags & HTML_EVENT_FLAG_CTRL_DOWN)
								{
									End();
								}
								else
								{
									LineEnd();
								}
								break;

							case WGK_LNUP:
								LineUp();
								break;

							case WGK_LNDN:
								LineDown();
								break;
						}
						if (selecting)
						{
							EndSelect();
						}
						break;
					}

					case WGK_ESC:
						SelectAll();
						break;

					case WGK_CR:
						InsertChar((WebChar) '\n');
						break;

					default:
						WebEditString::Event(e);
						break;
				}
			}
			break;

		default:
			WebEditString::Event(e);
			break;
	}

	return (HTML_EVENT_STATUS_CONTINUE);
}
Beispiel #19
0
bool LineEdit::Key(dword key, int count) {
	NextUndo();
	switch(key) {
	case K_CTRL_UP:
		ScrollUp();
		return true;
	case K_CTRL_DOWN:
		ScrollDown();
		return true;
	case K_INSERT:
		OverWriteMode(!IsOverWriteMode());
		break;
	}
	bool sel = key & K_SHIFT;
	switch(key & ~K_SHIFT) {
	case K_CTRL_LEFT:
		{
			PlaceCaret(GetPrevWord(cursor), sel);
			break;
		}
	case K_CTRL_RIGHT:
		{
			PlaceCaret(GetNextWord(cursor), sel);
			break;
		}
	case K_LEFT:
		MoveLeft(sel);
		break;
	case K_RIGHT:
		MoveRight(sel);
		break;
	case K_HOME:
		MoveHome(sel);
		break;
	case K_END:
		MoveEnd(sel);
		break;
	case K_UP:
		MoveUp(sel);
		break;
	case K_DOWN:
		MoveDown(sel);
		break;
	case K_PAGEUP:
		MovePageUp(sel);
		break;
	case K_PAGEDOWN:
		MovePageDown(sel);
		break;
	case K_CTRL_PAGEUP:
	case K_CTRL_HOME:
		MoveTextBegin(sel);
		break;
	case K_CTRL_PAGEDOWN:
	case K_CTRL_END:
		MoveTextEnd(sel);
		break;
	case K_CTRL_C:
	case K_CTRL_INSERT:
		Copy();
		break;
	case K_CTRL_A:
		SelectAll();
		break;
	default:
		if(IsReadOnly())
			return MenuBar::Scan(WhenBar, key);
		switch(key) {
		case K_DELETE:
			DeleteChar();
			break;
		case K_BACKSPACE:
		case K_SHIFT|K_BACKSPACE:
			Backspace();
			break;
	   	case K_SHIFT_TAB:
			AlignChar();
			break;
		case K_CTRL_Y:
		case K_CTRL_L:
			if(cutline) {
				CutLine();
				break;
			}
		default:
			if(InsertChar(key, count, true))
				return true;
			return MenuBar::Scan(WhenBar, key);
		}
		return true;
	}
	Sync();
	return true;
}
Beispiel #20
0
void ExecMinusButton(void)
{
    int i;
    char aChar;
    BOOLEAN doCmd = FALSE;
    BOOLEAN dotSeen = FALSE;

    CtlRecHndl entryBox = GetCtlHandleFromID(gCalcWinPtr, abCalcEntryBox);
    GetLETextByID(gCalcWinPtr, abCalcEntryBox, &gStrBuf);

    if (gStrBuf.textLength > 0) {
        doCmd = TRUE;

        gStrBuf.text[gStrBuf.textLength] = '\0';

        aChar = gStrBuf.text[gStrBuf.textLength - 1];
        if (((aChar == 'e') ||
                (aChar == 'E')) &&
                (gStrBuf.textLength > 1)) {
            doCmd = FALSE;
            for (i = 0; i < gStrBuf.textLength - 1; i++) {
                switch (gStrBuf.text[i]) {
                case '-':
                    if (i != 0) {
                        doCmd = TRUE;
                    }
                    break;

                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    break;

                case '.':
                    if (dotSeen) {
                        doCmd = TRUE;
                    } else {
                        dotSeen = TRUE;
                    }
                    break;

                default:
                    doCmd = TRUE;
                    break;
                }
                if (doCmd)
                    break;
            }
        }
    }

    if (doCmd) {
        ExecCalcCmd("-");
    } else {
        InsertChar(entryBox, '-');
    }

    return;
}
Beispiel #21
0
void HandleControl(EventRecord *event)
{
    CtlRecHndl entryBox = GetCtlHandleFromID(gCalcWinPtr, abCalcEntryBox);
    SetPort(gCalcWinPtr);

    switch (event->wmTaskData4) {
    case abCalcBtn0:
        InsertChar(entryBox, '0');
        break;

    case abCalcBtn1:
        InsertChar(entryBox, '1');
        break;

    case abCalcBtn2:
        InsertChar(entryBox, '2');
        break;

    case abCalcBtn3:
        InsertChar(entryBox, '3');
        break;

    case abCalcBtn4:
        InsertChar(entryBox, '4');
        break;

    case abCalcBtn5:
        InsertChar(entryBox, '5');
        break;

    case abCalcBtn6:
        InsertChar(entryBox, '6');
        break;

    case abCalcBtn7:
        InsertChar(entryBox, '7');
        break;

    case abCalcBtn8:
        InsertChar(entryBox, '8');
        break;

    case abCalcBtn9:
        InsertChar(entryBox, '9');
        break;

    case abCalcBtnEnter:
        PushCalcEntry(entryBox);
        ErrorRaised();
        UpdateStack();
        break;

    case abCalcBtnDot:
        InsertChar(entryBox, '.');
        break;

    case abCalcBtnNum:
        InsertChar(entryBox, '#');
        break;

    case abCalcBtnAdd:
        ExecCalcCmd("+");
        break;

    case abCalcBtnSub:
        ExecMinusButton();
        break;

    case abCalcBtnMult:
        ExecCalcCmd("*");
        break;

    case abCalcBtnDiv:
        ExecCalcCmd("/");
        break;

    case abCalcBtnPow:
        ExecCalcCmd("^");
        break;

    case abCalcBtnA:
        InsertChar(entryBox, 'A');
        break;

    case abCalcBtnB:
        InsertChar(entryBox, 'B');
        break;

    case abCalcBtnC:
        InsertChar(entryBox, 'C');
        break;

    case abCalcBtnD:
        InsertChar(entryBox, 'D');
        break;

    case abCalcBtnE:
        InsertChar(entryBox, 'E');
        break;

    case abCalcBtnF:
        InsertChar(entryBox, 'F');
        break;

    case abCalcEntryBox:
        HandleEntryBox();
        break;

    case abCalcStackList:
        HandleStackClick();
        break;

    case abCalcOpList:
        HandleOpClick();
        break;
    }
}
Beispiel #22
0
int EBuffer::InsertTab() {
    return (BFI(this, BFI_SpaceTabs)) ?
           InsertSpacesToTab(BFI(this, BFI_TabSize)) : InsertChar(9);
}
Beispiel #23
0
//--------------------------------------------------------------------------
//	功能:窗口函数(处理消息)
//--------------------------------------------------------------------------
int KWndEdit::WndProc(unsigned int uMsg, unsigned int uParam, int nParam)
{
	int	nRet = 0;
	if (m_Flag & WNDEDIT_ES_WIN32_WND)
	{
		if (uMsg == WM_KEYDOWN)
			nRet = OnKeyDownWin32(uParam, nParam);
		if (uMsg == WND_M_SET_FOCUS)
			Win32Edit_SetFocus(m_hWin32Wnd, true);
		else if (uMsg == WND_M_KILL_FOCUS)
			Win32Edit_SetFocus(m_hWin32Wnd, false);
		return 0;
	}

	switch(uMsg)
	{
	case WM_LBUTTONDOWN:
	case WM_RBUTTONDOWN:
		if (IsVisible() && Wnd_GetFocusWnd() != (KWndWindow*)this)
		{
			Wnd_SetFocusWnd((KWndWindow*)this);
		}
		else
			nRet = KWndWindow::WndProc(uMsg, uParam, nParam);
		break;
	case WM_IME_CHAR:
	case WM_CHAR:
		if ((m_Flag & WNDEDIT_F_HAVE_FOCUS) && ((m_Style & WND_S_DISABLE) == 0))
		{
			if (InsertChar(uParam))
				UpdateData();
			nRet = 1;
		}
		break;
	case WM_KEYDOWN:
		if (!IsDisable())
			nRet = OnKeyDown(uParam, nParam);
		break;
	case WND_M_SET_FOCUS:
		if (m_pText)
		{
			if (m_Flag & WNDEDIT_ES_IME_AVAILABLE)
			{
				s_Ime.EnableLanguageChange();
				if (s_LastTimeIsIme)
				    s_Ime.OpenIME();
			}

//			m_nCaretPos = m_nTextLen;	//把光标位置设在文本末尾
			m_Flag |= WNDEDIT_F_HAVE_FOCUS;
			m_nCaretTime = 0;

//			CreateCaret(::g_GetMainHWnd(), (HBITMAP)NULL, 2, m_nFontSize);
            m_nCaretX = m_nAbsoluteLeft;
            m_nCaretY = m_nAbsoluteTop;
            SetCaretPos(m_nCaretX, m_nCaretY);
            s_Ime.SetCaretPos(m_nCaretX, m_nCaretY);

//          ShowCaret(::g_GetMainHWnd());
		}
		break;
	case WND_M_KILL_FOCUS:
//        DestroyCaret();

		if (m_Flag & WNDEDIT_ES_IME_AVAILABLE)
			s_LastTimeIsIme = s_Ime.IsIme();
		s_Ime.DisableLanguageChange();
		s_Ime.CloseIME();
		m_Flag &= ~WNDEDIT_F_HAVE_FOCUS;
		break;
	case WM_SYSKEYDOWN:
		if (m_pParentWnd)
			nRet = m_pParentWnd->WndProc(uMsg, uParam, nParam);
		break;
	case WM_MOUSEWHEEL:
		if (!IsDisable())
		{
			int zDelta = GET_Y_LPARAM(uParam);
			if (zDelta != 0)
				nRet = OnKeyDown(zDelta < 0 ? VK_DOWN : VK_UP, 0);
		}
		break;

    case WM_MOVING:
    case WM_MOVE:
    {
        if (m_Flag & WNDEDIT_ES_WIN32_WND)
        {
    	    Win32Edit_UpdateSizePos(m_hWin32Wnd, m_nAbsoluteLeft, m_nAbsoluteTop, m_Width, m_Height);
            break;
        }
    }
	default:
		nRet = KWndWindow::WndProc(uMsg, uParam, nParam);
		break;
	}
	return nRet;
}
Beispiel #24
0
//--------------------------------------------------------------------------
//	功能:响应键盘按键操作
//--------------------------------------------------------------------------
int KWndEdit::OnKeyDown(int nKeyCode, int nModifiers)
{
	int nRet = 1;
	switch(nKeyCode)
	{
	case VK_DELETE:
		if (m_nCaretPos < m_nTextLen)
		{
			int nNextPos = TSplitString(m_pText + m_nCaretPos, 1, false);
			m_nTextLen -= nNextPos;
			memmove(m_pText + m_nCaretPos, m_pText + m_nCaretPos + nNextPos, m_nTextLen - m_nCaretPos + 1);
			UpdateData();
		}
		break;
	case VK_LEFT:
		if (m_nCaretPos)
		{
			m_nCaretPos = TSplitString(m_pText, m_nCaretPos - 1, true);
			FmtForShow();
		}
		break;
	case VK_RIGHT:
		if (m_nCaretPos < m_nTextLen)
		{
			m_nCaretPos += TSplitString(m_pText + m_nCaretPos, 1, false);
			FmtForShow();
		}
		break;
	case VK_HOME:
		m_nCaretPos = 0;
		FmtForShow();
		break;
	case VK_END:
		m_nCaretPos = m_nTextLen;
		FmtForShow();
		break;
	case VK_UP:
		if (MULTI_LINE && m_nCaretLineIndex)
		{
			int nCharPerLine = (m_Width * 2) / m_nFontSize;
			int nLineHead = 0, nLineEnd = 0;
			for (nRet = 0; nRet < m_nCaretLineIndex; nRet++)
			{
				nLineHead = nLineEnd;
				nLineEnd = nLineHead + SplitStringLine(&m_pText[nLineHead], 1, nCharPerLine);
			}

			m_nCaretPos = nLineHead + TSplitString(&m_pText[nLineHead],
				(m_nCaretPos - nLineEnd), false);
			if (m_nCaretPos >= nLineEnd && nLineEnd)
			{
				m_nCaretPos = nLineEnd;
				if(m_pText[nLineEnd - 1] == KTC_ENTER)
					m_nCaretPos--;
			}
			FmtForShow();
		}
		else if (m_pParentWnd)
			nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_UP);
		break;
	case VK_DOWN:
		if (MULTI_LINE)
		{
			int nCharPerLine = (m_Width * 2) / m_nFontSize;
			int nLineHead = 0, nLineEnd = 0;
			for (nRet = 0; nRet <= m_nCaretLineIndex; nRet++)
			{
				nLineHead = nLineEnd;
				nLineEnd = nLineHead + SplitStringLine(&m_pText[nLineHead], 1, nCharPerLine);
			}

			m_nCaretPos = nLineEnd + TSplitString(&m_pText[nLineEnd],
				(m_nCaretPos - nLineHead), false);
			nLineHead = nLineEnd;
			nLineEnd = nLineHead + SplitStringLine(&m_pText[nLineHead], 1, nCharPerLine);
			if (m_nCaretPos >= nLineEnd && nLineEnd)
			{
				m_nCaretPos = nLineEnd;
				if(m_pText[nLineEnd - 1] == KTC_ENTER)
					m_nCaretPos--;
			}
			FmtForShow();
		}
		else if (m_pParentWnd)
			nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_DOWN);
		break;
	case VK_TAB:
	case VK_PRIOR:
	case VK_NEXT:
	case VK_ESCAPE:
		if (m_pParentWnd)
			nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, nKeyCode);
		break;
	case VK_RETURN:
		if (m_pParentWnd)
		{
			if ((m_Flag & WNDEDIT_ES_MULTI_LINE) == 0)
				nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_RETURN);
			else if ((GetKeyState(VK_CONTROL) & 0x8000) == 0 && (GetKeyState(VK_SHIFT) & 0x8000) == 0)
				nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_RETURN);
			else if (InsertChar(0x0a, 0))
			{
				UpdateData();
				nRet = 1;
			}
		}
		break;
	case 'V':	//粘帖
		if ((GetKeyState(VK_CONTROL) & 0x8000) && Paste())
			nRet = 1;
		break;
	case 'C':	//复制
		if ((GetKeyState(VK_CONTROL) & 0x8000) && Copy())
			nRet = 1;
		break;
	default:
		if ((nKeyCode < '0' || nKeyCode > '9') &&
			(nKeyCode < 'A' || nKeyCode > 'Z') &&
			(nKeyCode < VK_NUMPAD0 || nKeyCode > VK_DIVIDE))
		{
			nRet = 0;
		}
	}
	return nRet;
}