本文整理汇总了C++中GetEditCtrl函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEditCtrl函数的具体用法?C++ GetEditCtrl怎么用?C++ GetEditCtrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetEditCtrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Files
void CEditorView::OnPopupLoad()
{
// TODO: Add your command handler code here
BOOL endmarker;
CString FileName;
CString WindowText;
CString WindowLine;
static char BASED_CODE szFilter[] = "Text Files (*.txt)|*.txt|Data Files (*.dat)|*.dat|All Files (*.*)|*.*||";
CFileDialog* pLoadFile = new CFileDialog(TRUE,NULL,NULL,0,&szFilter[0],NULL);
if (IDOK==pLoadFile->DoModal())
{
WindowText = "";
FileName = pLoadFile->GetPathName();
delete pLoadFile;
CStdioFile* pFile = new CStdioFile(FileName,CFile::modeRead);
do
{
endmarker = pFile->ReadString(WindowLine);
WindowText = WindowText+WindowLine+"\r\n";
}
while (endmarker);
GetEditCtrl().SetSel(-1,0,FALSE);
GetEditCtrl().ReplaceSel(WindowText);
pFile->Close();
delete pFile;
}
}
示例2: Default
LRESULT COXNotesEditView::OnSetMargins(WPARAM wParam, LPARAM lParam)
{
if (m_bUpdatingMargins)
return Default();
switch (wParam)
{
case EC_USEFONTINFO:
{
LRESULT lRslt=Default();
m_bUpdatingMargins=TRUE;
m_nMargins=PtrToUint(SendMessage(EM_GETMARGINS,0,0));
switch (m_nSide)
{
case SIDE_LEFT:
GetEditCtrl().SetMargins(LOWORD(m_nMargins)+m_nNotesWidth,
HIWORD(m_nMargins));
break;
case SIDE_RIGHT:
GetEditCtrl().SetMargins(LOWORD(m_nMargins),
HIWORD(m_nMargins)+m_nNotesWidth);
break;
}
m_bUpdatingMargins=FALSE;
return lRslt;
}
break;
case EC_LEFTMARGIN:
m_nMargins=MAKELONG(lParam,HIWORD(m_nMargins));
if (m_nSide==SIDE_LEFT)
{
m_bUpdatingMargins=TRUE;
LPARAM lPrm=MAKELONG(LOWORD(m_nMargins)+m_nNotesWidth,
HIWORD(m_nMargins));
LRESULT lRslt=SendMessage(EM_SETMARGINS,wParam,lPrm);
m_bUpdatingMargins=FALSE;
return lRslt;
}
else
return Default();
break;
case EC_RIGHTMARGIN:
m_nMargins=MAKELONG(LOWORD(m_nMargins),lParam);
if (m_nSide==SIDE_RIGHT)
{
m_bUpdatingMargins=TRUE;
LPARAM lPrm=MAKELONG(LOWORD(m_nMargins),
HIWORD(m_nMargins)+m_nNotesWidth);
LRESULT lRslt=SendMessage(EM_SETMARGINS,wParam,lPrm);
m_bUpdatingMargins=FALSE;
return lRslt;
}
else
return Default();
break;
default:
return Default();
}
}
示例3: _T
void MsgWndView::DisplayMessage(LPCTSTR msg)
{
CString strTemp = msg;
strTemp += _T("\r\n");
int len = GetEditCtrl().GetWindowTextLength();
GetEditCtrl().SetSel(len, len);
GetEditCtrl().ReplaceSel(strTemp);
}
示例4: goDlg
void CSynBCGPEditView::OnEditGotoLine()
{
CGotoLineDlg goDlg(this, GetEditCtrl()->GetLineCount());
if (goDlg.DoModal() != IDOK)
{
return;
}
GetEditCtrl()->GoToLine(goDlg.m_nLineNumber);
}
示例5: GetEditCtrl
BOOL CxEditView::OnEscape(UINT)
{
BOOL bHandled = FALSE;
if (GetEditCtrl().IsSelection())
{
GetEditCtrl().SelectNone();
bHandled = TRUE;
}
return bHandled;
}
示例6: ASSERT_VALID
void CEditView::ReadFromArchive(CArchive& ar, UINT nLen)
// Read certain amount of text from the file, assume at least nLen
// characters (not bytes) are in the file.
{
ASSERT_VALID(this);
LPVOID hText = LocalAlloc(LMEM_MOVEABLE, (nLen+1)*sizeof(TCHAR));
if (hText == NULL)
AfxThrowMemoryException();
LPTSTR lpszText = (LPTSTR)LocalLock(hText);
ASSERT(lpszText != NULL);
if (ar.Read(lpszText, nLen*sizeof(TCHAR)) != nLen*sizeof(TCHAR))
{
LocalUnlock(hText);
LocalFree(hText);
AfxThrowArchiveException(CArchiveException::endOfFile);
}
// Replace the editing edit buffer with the newly loaded data
lpszText[nLen] = '\0';
#ifndef _UNICODE
if (afxData.bWin32s)
{
// set the text with SetWindowText, then free
BOOL bResult = ::SetWindowText(m_hWnd, lpszText);
LocalUnlock(hText);
LocalFree(hText);
// make sure that SetWindowText was successful
if (!bResult || ::GetWindowTextLength(m_hWnd) < (int)nLen)
AfxThrowMemoryException();
// remove old shadow buffer
delete[] m_pShadowBuffer;
m_pShadowBuffer = NULL;
m_nShadowSize = 0;
ASSERT_VALID(this);
return;
}
#endif
LocalUnlock(hText);
HLOCAL hOldText = GetEditCtrl().GetHandle();
ASSERT(hOldText != NULL);
LocalFree(hOldText);
GetEditCtrl().SetHandle((HLOCAL)(UINT)(DWORD)hText);
Invalidate();
ASSERT_VALID(this);
}
示例7: GetEditCtrl
BOOL COXNotesEditView::ShowBookmark(UINT nChar)
{
if (IsMarked(nChar))
{
UINT nLine=GetEditCtrl().LineFromChar(nChar);
UINT nFirstVisible=GetEditCtrl().GetFirstVisibleLine();
UINT nLastVisible=GetLastVisibleLine();
if (nFirstVisible>nLine || nLastVisible<nLine)
GetEditCtrl().LineScroll(nLine-nFirstVisible);
return TRUE;
}
else
return FALSE;
}
示例8: dlg
void CxEditView::OnFormatFont()
{
CxFontDialog dlg(this);
dlg.m_sample = GetEditCtrl().GetSelText();
::FontDialog(this, &m_font, CF_EFFECTS | CF_SCREENFONTS, &dlg);
}
示例9: PyCEdit_create_window
// @pymethod |PyCEdit|CreateWindow|Creates the window for a new Edit object.
static PyObject *
PyCEdit_create_window(PyObject *self, PyObject *args)
{
int style, id;
PyObject *obParent;
RECT rect;
if (!PyArg_ParseTuple(args, "i(iiii)Oi:CreateWindow",
&style, // @pyparm int|style||The style for the Edit. Use any of the win32con.BS_* constants.
&rect.left,&rect.top,&rect.right,&rect.bottom,
// @pyparm (left, top, right, bottom)|rect||The size and position of the Edit.
&obParent, // @pyparm <o PyCWnd>|parent||The parent window of the Edit. Usually a <o PyCDialog>.
&id )) // @pyparm int|id||The Edits control ID.
return NULL;
if (!ui_base_class::is_uiobject(obParent, &PyCWnd::type))
RETURN_TYPE_ERR("parent argument must be a window object");
CWnd *pParent = GetWndPtr( obParent );
if (pParent==NULL)
return NULL;
CEdit *pEdit = GetEditCtrl(self);
if (!pEdit)
return NULL;
BOOL ok;
GUI_BGN_SAVE;
ok = pEdit->Create(style, rect, pParent, id );
GUI_END_SAVE;
if (!ok)
RETURN_ERR("CEdit::Create");
RETURN_NONE;
}
示例10: GetEditCtrl
// @pymethod |PyCEdit|SetSel|Sets the selection in the edit control.
static PyObject *PyCEdit_set_sel(PyObject *self, PyObject *args)
{
CEdit *pEdit = GetEditCtrl(self);
int start=0,end=0;
BOOL bNoScroll = FALSE;
if (!pEdit)
return NULL;
if (!PyArg_ParseTuple(args, "i|ii:SetSel",
&start, // @pyparm int|start||Specifies the starting position.
// If start is 0 and end is -1, all the text in the edit control is selected.
// If start is -1, any current selection is removed.
&end, // @pyparm int|end|start|Specifies the ending position.
&bNoScroll)) { // @pyparm int|bNoScroll|0|Indicates whether the caret should be scrolled into view. If 0, the caret is scrolled into view. If 1, the caret is not scrolled into view.
PyErr_Clear();
bNoScroll = FALSE;
if (!PyArg_ParseTuple(args, "(ii)|i:SetSel",
&start, // @pyparmalt2 (int, int)|start,end)||As for normal start, end args.
&end,
&bNoScroll)) // @pyparmalt2 int|bNoScroll|0|Indicates whether the caret should be scrolled into view. If 0, the caret is scrolled into view. If 1, the caret is not scrolled into view.
return NULL;
}
if (start!=end && end==0)
end=start;
GUI_BGN_SAVE;
pEdit->SetSel(start,end,bNoScroll); // @pyseemfc CEdit|SetSel
GUI_END_SAVE;
RETURN_NONE;
}
示例11: BeginNewLine
void CBaseView::OutputMsgLine( const char * line )
{
BeginNewLine( );
OutputMsgHeader( );
m_astrMsg.Add( line );
GetEditCtrl().ReplaceSel( line );
}
示例12: GetEditCtrl
void CBaseView::BeginNewLine( )
{
GetEditCtrl().SetSel( -1, -1 );
int nLineCount = GetEditCtrl().GetLineCount();
if( nLineCount >= 1 )
{
//int nLineIndex = GetEditCtrl().LineIndex( nLineCount-1 );
//int nLineLen = GetEditCtrl().LineLength( nLineIndex );
CPoint point = GetEditCtrl().PosFromChar( UINT(-1)/*nLineIndex+nLineLen*/ );
GetEditCtrl().SetCaretPos( point );
}
CString string = STRING_CRLF;
GetEditCtrl().ReplaceSel( string );
}
示例13: ImageFromLine
int COXNotesEditView::ImageFromLine(UINT nLine) const
{
int nRet=-1;
CEdit& edt=GetEditCtrl();
UINT nFirst=edt.LineIndex(nLine);
UINT nLast=edt.LineLength(edt.LineIndex(nLine));
if (nLast)
nLast=nLast+nFirst-1;
else
nLast=nFirst;
for (int n=0;n<m_arBookmarks.GetSize();n++)
{
//every value in the m_arBookmarks array
//consists of index of the char the bookmark set to
//(that is 24 least significant bits in the value) and
//8 most significant bits represents image index of
//the bookmark in m_imgBookmarks
DWORD dwIndex=m_arBookmarks.GetAt(n);
DWORD dwChar=0x00FFFFFF & dwIndex;
if (dwChar>=nFirst)
{
if (dwChar<=nLast)
nRet=dwIndex>>24;
else
return nRet;
}
}
示例14: GetNotesRect
void COXNotesEditView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
CRect rct;
GetNotesRect(&rct);
if (rct.PtInRect(point))
{
int n=HIWORD(GetEditCtrl().CharFromPos(point));
int nChar=GetEditCtrl().LineIndex(n);
if (IsMarked(nChar))
RemoveBookmarks(nChar,nChar);
else
SetBookmark(nChar);
}
CEditView::OnLButtonDblClk(nFlags, point);
}
示例15: GetParentFrame
void CMsgView::OnContextMenu(CWnd *pWnd, CPoint point)
{
CFrameWnd *pFrame;
CMenu menu;
CMenu *pPopupMenu;
int nStart;
int nEnd;
UINT uiEnable;
// make sure window is active
pFrame = GetParentFrame ();
ASSERT (pFrame != NULL);
if (pFrame != NULL)
{
pFrame->ActivateFrame ();
};
if (!menu.LoadMenu (IDR_COMPILEVW_POPUP))
{
return;
}
pPopupMenu = menu.GetSubMenu (0);
ASSERT (pPopupMenu != NULL);
if (pPopupMenu == NULL)
{
return;
}
GetEditCtrl().GetSel(nStart, nEnd);
uiEnable = (nStart == nEnd) ? MF_DISABLED | MF_GRAYED : MF_ENABLED;
pPopupMenu->EnableMenuItem(IDM_MSG_COPY, uiEnable);
pPopupMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}