Пример #1
0
void CMyEdit::SetDefaultTextMode(BOOL bIsDefText)
{
	if (bIsDefText == m_bIsDefText)
		return;

	m_bIsDefText = bIsDefText;
	if (m_bIsDefText)
	{
		m_cPwdChar = GetPasswordChar();
		SetPasswordChar(0);
		SetWindowText(m_strDefText);
	}
	else
	{
		SetPasswordChar(m_cPwdChar);
		SetWindowText(_T(""));
	}
}
void CPropTreeItemEdit::OnActivate( int activateType, CPoint point ) {
	// Check if the edit control needs creation
	if( !IsWindow( m_hWnd ) ) {
		DWORD dwStyle;
		dwStyle = WS_CHILD | ES_AUTOHSCROLL;
		Create( dwStyle, m_rc, m_pProp->GetCtrlParent(), GetCtrlID() );
	}
	SendMessage( WM_SETFONT, ( WPARAM )m_pProp->GetNormalFont()->m_hObject );
	SetPasswordChar( ( TCHAR )( m_bPassword ? '*' : 0 ) );
	SetWindowText( m_sEdit );
	SetSel( 0, -1 );
	SetWindowPos( NULL, m_rc.left, m_rc.top, m_rc.Width(), m_rc.Height(), SWP_NOZORDER | SWP_SHOWWINDOW );
	SetFocus();
}
Пример #3
0
void CMyEdit::OnSetFocus(CWnd* pOldWnd)
{
	CEdit::OnSetFocus(pOldWnd);

	if (m_bIsDefText)
	{
		m_bIsDefText = FALSE;
		SetPasswordChar(m_cPwdChar);
		SetWindowText(_T(""));
	}

	m_bFocus = TRUE;
	RedrawWindow(NULL,NULL,RDW_FRAME|RDW_INVALIDATE|RDW_ERASE|RDW_ERASENOW);
}
Пример #4
0
void CMyEdit::OnKillFocus(CWnd* pNewWnd)
{
	CEdit::OnKillFocus(pNewWnd);

	if (GetWindowTextLength() <= 0 && !m_strDefText.IsEmpty())
	{
		m_bIsDefText = TRUE;
		m_cPwdChar = GetPasswordChar();
		SetPasswordChar(0);
		SetWindowText(m_strDefText);
	}

	m_bFocus = FALSE;
	RedrawWindow(NULL,NULL,RDW_FRAME|RDW_INVALIDATE|RDW_ERASE|RDW_ERASENOW);
}
Пример #5
0
void CSkinEdit::OnSetFocus(CWnd* pOldWnd)
{
	__super::OnSetFocus(pOldWnd);

	if (m_bIsDefText)
	{
		m_bIsDefText = FALSE;
		SetPasswordChar(m_cPwdChar);
		SetWindowText(_T(""));
	}

	m_bFocus = TRUE;
	//Invalidate(FALSE);

	OnNcPaint();
}
Пример #6
0
void CSkinEdit::OnKillFocus(CWnd* pNewWnd)
{
	__super::OnKillFocus(pNewWnd);

	if (GetWindowTextLength() <= 0 && !m_strDefText.IsEmpty())
	{
		m_bIsDefText = TRUE;
		m_cPwdChar = GetPasswordChar();
		SetPasswordChar(0);
		SetWindowText(m_strDefText);
	}

	m_bFocus = FALSE;
	//Invalidate(FALSE);

	OnNcPaint();
}
Пример #7
0
void VTextControl::Serialize( VArchive &ar )
{
  char iLocalVersion = 1;
  VDlgControlBase::Serialize(ar);
  if (ar.IsLoading())
  {
    ar >> iLocalVersion; VASSERT_MSG(iLocalVersion<=1,"Invalid version");
    ar >> m_Frame;
    ar >> m_sValidChars;
    ar >> m_iMaxChars;
    ar >> m_sCurrentText >> m_Text >> m_vTextOfs >> m_fTextOfs;
    ar >> m_fCursorPhase >> m_iCursorPos;
    if (iLocalVersion>=1)
    {
      int iChar;
      ar >> iChar;
      SetPasswordChar(iChar); // we need the change callback
    }
Пример #8
0
void CSkinEdit::SetAttribute( LPCTSTR pstrName, LPCTSTR pstrValue )
{
	ISkinControl::SetAttribute(pstrName,pstrValue);

	if( _tcscmp(pstrName, _T("defaulttext")) == 0 )  
	{
		SetDefaultText(pstrValue);
		SetDefaultTextMode(TRUE);
	}
	else if( _tcscmp(pstrName, _T("iconimage")) == 0 )  
	{
		SetIconImage(pstrValue);
	}
	else if( _tcscmp(pstrName, _T("passwordchar")) == 0 )  
	{
		SetPasswordChar(pstrValue[0]);
	}
	else if( _tcscmp(pstrName, _T("clientpos")) == 0 )  
	{
		LPTSTR pstr = NULL;
		CPoint pt;
		pt.x = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
		pt.y = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr); 

		SetClientPoint(pt);
	}
	else if( _tcscmp(pstrName, _T("handcur")) == 0 )  
	{
		m_bHandCursor = _tcscmp(pstrValue, _T("true")) == 0;
	}
	else if( _tcscmp(pstrName, _T("scrollimage")) == 0 )  
	{
		SetScrollImage(this,pstrValue);
	}
	//else if( _tcscmp(pstrName, _T("multiline")) == 0 )  
	//{
	//	if( _tcscmp(pstrValue, _T("true")) == 0 )  
	//	//	//SetWindowLong(GetSafeHwnd(),GWL_STYLE,GetWindowLong(GetSafeHwnd(),GWL_STYLE)| ES_MULTILINE|ES_WANTRETURN|ES_AUTOVSCROLL| WS_VSCROLL);
	//		ModifyStyle(ES_AUTOHSCROLL,ES_MULTILINE|ES_WANTRETURN|ES_AUTOVSCROLL| WS_VSCROLL );
	//	//ModifyStyle(ES_MULTILINE|ES_WANTRETURN|ES_AUTOVSCROLL| WS_VSCROLL,0);
	//}
}
Пример #9
0
	void CEditUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
	{
		if( _tcsicmp(pstrName, _T("readonly")) == 0 ) SetReadOnly(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("numberonly")) == 0 ) SetNumberOnly(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("password")) == 0 ) SetPasswordMode(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("passwordchar")) == 0 ) SetPasswordChar(*pstrValue);
		else if( _tcsicmp(pstrName, _T("maxchar")) == 0 ) SetMaxChar(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("normalimage")) == 0 ) SetNormalImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("hotimage")) == 0 ) SetHotImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("focusedimage")) == 0 ) SetFocusedImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("disabledimage")) == 0 ) SetDisabledImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("tipvalue")) == 0 ) SetTipValue(pstrValue);
		else if( _tcsicmp(pstrName, _T("tipvaluecolor")) == 0 ) SetTipValueColor(pstrValue);
		else if( _tcsicmp(pstrName, _T("nativetextcolor")) == 0 ) SetNativeEditTextColor(pstrValue);
		else if( _tcsicmp(pstrName, _T("nativebkcolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetNativeEditBkColor(clrColor);
		}
		else CLabelUI::SetAttribute(pstrName, pstrValue);
	}