Exemplo n.º 1
0
void  CArborEdit::DDV_Numeric()
{
  if( GetModify() )
  {
		int iMinVal = 0;
		int iMaxVal = 0;

		// if they didn't set a range, but entered a number, validate with max values
		// that can be stored in the database.....
		if( m_bIntRangeSet )
		{
			 iMinVal = m_iMinValue;
			 iMaxVal = m_iMaxValue;
		}
		else
		{
			 if( m_bNegativeValue ) 
				 iMinVal = INT_MIN;
			 else
				 iMinVal = 0;
			 iMaxVal = INT_MAX;
		}

		if( !ValidateNum( iMinVal, iMaxVal )  ) 
		{
		  CGuiMsg::GuiMessage(GUIMSG_NUMBER_INT_RANGE_INVALID,
					                iMinVal, iMaxVal );
			SetSel( 0, -1 );
			SetFocus();
			AfxThrowUserException();
		}
	}
}
Exemplo n.º 2
0
void  CArborEdit::DDV_Float()
{
	 // check to see if the control was modified at all....if so continue
   if( GetModify() )
   {
		 double dMinVal = 0.0;
		 double dMaxVal = 0.0;

		 // if they didn't set a range, but entered a number, validate with max values
		 // that can be stored in the database.....
		 if( m_bDoubleRangeSet )
		 {
			 dMinVal = m_dMinValue;
			 dMaxVal = m_dMaxValue;
		 }
		 else
		 {
			 if( m_bNegativeValue ) 
				 dMinVal = INT_MIN/100.0;
			 else
				 dMinVal = 0.0;
			 dMaxVal = INT_MAX/100.0;
		 }

		if( !ValidateDouble( dMinVal, dMaxVal ) ) 
		{
		  CGuiMsg::GuiMessage(GUIMSG_NUMBER_DOUBLE_RANGE_INVALID,
			 		                dMinVal, dMaxVal );
			SetSel( 0, -1 );
			SetFocus();
			AfxThrowUserException();
		}		   	 
	}
}
Exemplo n.º 3
0
void CPopupEdit::OnKillFocus(CWnd* pNewWnd) 
{
	CEdit::OnKillFocus(pNewWnd);

	CString Text;
	GetWindowText(Text);

	if (Text != "INFINITY") {
		if (!atoi(Text)) {
			SetWindowText(m_sInitText);
			GetWindowText(Text);
		}

		Text.Format("%d", atoi(Text));

		CString Temp;
		GetWindowText(Temp);
		Temp = Temp.Right(1);
				
		if (!Temp.SpanIncluding("kKmMgG").IsEmpty())
			Text.Format("%s%s", LPCTSTR(Text), LPCTSTR(Temp));

		CString OldText;
		GetWindowText(OldText) ;
		if (GetModify() || OldText != Text)
			SetWindowText(Text);
	}

	if (m_bIsEmbeddedIntoListCtrl) {
		CWnd *Parent = GetParent();
		ASSERT_VALID(Parent);

		CString str;
		GetWindowText(str);

		LV_DISPINFO dispinfo;
		dispinfo.hdr.hwndFrom  = Parent->m_hWnd;
		dispinfo.hdr.idFrom    = GetDlgCtrlID();
		dispinfo.hdr.code      = LVN_ENDLABELEDIT;

		dispinfo.item.mask     = LVIF_TEXT;
		dispinfo.item.iItem    = m_iItem;
		dispinfo.item.iSubItem = m_iSubItem;

		if (m_bESC) {
			dispinfo.item.pszText    = NULL;
			dispinfo.item.cchTextMax = 0;
		}
		else {
			dispinfo.item.pszText    = const_cast<LPTSTR>((LPCTSTR) str);
			dispinfo.item.cchTextMax = str.GetLength();
		}

		CWnd *ParentParent = Parent->GetParent();
		ASSERT_VALID(ParentParent);
		ParentParent->SendMessage(WM_NOTIFY, Parent->GetDlgCtrlID(), LPARAM(&dispinfo));
		DestroyWindow();
	}
}
Exemplo n.º 4
0
void Doc_Stc::OnClose (wxCommandEvent & event)
{
    if (GetModify())
    {
        int result = wxMessageBox(_T("This file has been modified. Save?"), _T("Save?"),
                                  wxYES_NO | wxCANCEL | wxICON_QUESTION);
        if (result == wxCANCEL) return;
    }
    delete this;
}
Exemplo n.º 5
0
void CNumEdit::OnKillfocus() 
{
	if (!GetModify()) {
		if (!IsUndoInProgress())
			CancelUndoableEdit(0);
	} else {
		GetText();
		SetText();
		NotifyParent();
	}
}
Exemplo n.º 6
0
BOOL CNumEdit::OnKillfocus() 
{
	if (GetModify()) {
		GetText();
		if (m_HaveRange) {
			m_Val = CLAMP(m_Val, m_MinVal, m_MaxVal);
			SetText();
		}
		Notify();
	}
	return(FALSE);	// let parent handle notification too
}
bool LuaScriptEditorView::QueryClose()
{
   if (!GetModify())
      return true;

   CWindow wndMain(GetParent());

   CString cszText;
   cszText.Format(_T("Save changes to %s ?"), m_cszFileTitle.GetString());

   int iRet = AtlMessageBox(wndMain, cszText.GetString(), IDR_MAINFRAME, MB_YESNOCANCEL | MB_ICONQUESTION);

   if (iRet == IDCANCEL)
      return false;
   else if (iRet == IDYES && !DoFileSaveAs())
      return false;

   return true;
}
Exemplo n.º 8
0
void CArborEditCurrency::OnKillfocus() 
{
  // check to see if the control was modified at all....if so continue
  if( GetModify() )
  {
		// check to see if any value has been entered into the control....
		if( GetWindowTextLength() )
		{
			CString sMoneyStr;

         // get the text entered
         GetWindowText(sMoneyStr);

         // make a numeric out of it and display it
         SetNumeric(sMoneyStr);
		}
      else
         SetNumeric("");
  }
}
Exemplo n.º 9
0
void  CArborEditCurrency::DDV_Float()
{
	 // check to see if the control was modified at all....if so continue
   if( GetModify() )
   {
		 double dMinVal = 0.0;
		 double dMaxVal = 0.0;

		 // if they didn't set a range, but entered a number, validate with max values
		 // that can be stored in the database.....
		 if( m_bDoubleRangeSet )
		 {
			 dMinVal = m_dMinValue;
			 dMaxVal = m_dMaxValue;
		 }
		 else
		 {
			 if( m_bNegativeValue ) 
				 dMinVal = INT_MIN/100.0;
			 else
				 dMinVal = 0.0;
			 dMaxVal = INT_MAX/100.0;
		 }

		if( !ValidateDouble( dMinVal, dMaxVal ) ) 
		{
			CString sMsg;
		//	sMsg.Format( "Number is not valid!\nPlease enter a number between %f - %f.", dMinVal, dMaxVal );
			sMsg.Format( GetIntlString(IDS_NUMBER_NOT_VALID_MSG),"%f - %f.", dMinVal, dMaxVal );
			AfxMessageBox( sMsg, MB_ICONEXCLAMATION );
			SetSel( 0, -1 );
			SetFocus();
			AfxThrowUserException();
		}		   	 
	}
}
Exemplo n.º 10
0
bool CScriptEditView::DoFileSave()
{
	ATLASSERT( m_szFilePath[0] != 0 );

	if( !GetModify() )
		return true;

	bool bRet = SaveFile( m_szFilePath );
	if( bRet )
	{
		SetModify( FALSE );
	}
	else
	{
		AtlMessageBox(
			WtlGetMainWnd(),
			IDS_WRITE_FILE_FAILED,
			IDR_MAINFRAME,
			MB_OK|MB_ICONERROR
			);
	}

	return bRet;
}
Exemplo n.º 11
0
bool CScriptEditView::QueryClose()
{
	if( !GetModify() )
		return true;

	TCHAR szFmt[32];
	AtlLoadString( IDS_SAVE_MODIFIED, szFmt, DIMOF(szFmt) );
	TCHAR szBuff[MAX_PATH + 40];
	wsprintf( szBuff, szFmt, m_szFileName );
	int nRet = AtlMessageBox(
		WtlGetMainWnd(),
		szBuff,
		IDR_MAINFRAME,
		MB_YESNOCANCEL | MB_ICONEXCLAMATION
		);

	if(nRet == IDCANCEL)
		return false;

	if(nRet == IDYES)
		return OnFileSave();

	return true;
}
Exemplo n.º 12
0
bool Edit::Modified () {

    // return modified state
    return (GetModify() && !GetReadOnly());
}
Exemplo n.º 13
0
bool CodeEditor::Modified()
{
	// Return modified state
	return (GetModify() && !GetReadOnly());
}
Exemplo n.º 14
0
BOOL CArborEdit::OnKillfocus() 
{
   // check to see if the control was modified at all....if so continue
   if( GetModify() )
   {
	   // check to see if any value has been entered into the control....
	   if( GetWindowTextLength() )
	   {
           //CAMqa72199 Wasabi - check for non-JIS chars in text field
           //Note that this code disallows extended Japanese characters
           //which are used in some proper names
           CString ControlText;
           if (ArbI18N::IsJapanese() || ArbI18N::IsBidi() ) 
           {
           	GetWindowText(ControlText);
	           int ctl = ControlText.GetLength();
	           int cursor = 0;
	           bool ok = true;
	           while ((cursor < ctl) && ok)
	           {
	               TCHAR c = ControlText[cursor];
	               if (IsDBCSLeadByteEx(932, c))
	               {
	                   cursor++; //skip trail byte if in a double byte char
					   //CAMqa77746 applying CAMqa70838 - delete the non-JIS character check
	               }
	               cursor++;
	           }
	           if (!ok)
	           {
	               AfxMessageBox(GetIntlString(IDS_GUI_MSG_INVALID_INPUT_CHAR), MB_ICONERROR);
	               SetSel( 0, -1 );
	               SetFocus();
	               AfxThrowUserException();
	           }
           } //CAMqa72199 End Japanese-only processing
		  if( EditStyleIs(EDIT_CURRENCY) || EditStyleIs(EDIT_FLOAT) ) 
			{
				double dTemp = GetDoubleValue();

				LPTSTR buff = new char[80];
				FloatToString( buff, dTemp) ;
				SetWindowText(buff);
				SetModify( TRUE ); 
				delete buff;
			}
			else 	if( EditStyleIs( EDIT_DATE	) )
			{
				CString ControlText;
				// Extract the text from the exit control and then 
				GetWindowText(ControlText);
															//we have to re-format Date on case if Date = "x/x/xx"
				//otherwise  ValidateDate()	function return FALSE
				COleDateTime oleDate;			
				//TCHAR year[5];
				
				if( !ParseDate( ControlText, oleDate ) ||						
				( oleDate.GetStatus() == COleDateTime::invalid ))  // invalid date
				{	 
					return FALSE;   // no message Boxes
				}


	         Arb_date CDate;
			char strdate[GAL_DATE_LEN];

        	CDate.year = oleDate.GetYear();
			CDate.month = oleDate.GetMonth();
			CDate.day = oleDate.GetDay();
			strcpy(strdate,(CString)Arbdate_to_string(&CDate,ArbI18N::GetSysDateFmt()));
			CString Text = CString(strdate);
			SetWindowText(Text);
			SetModify( TRUE ); 
				
			//SetWindowText(ControlText);
			SetModify( TRUE ); 
			}
		}
   }

   return FALSE;

}
Exemplo n.º 15
0
void CPDF_GeneralState::SetRenderIntent(const CFX_ByteString& ri) {
  GetModify()->m_RenderIntent = RI_StringToId(ri);
}