-
- // The item used for viewing the real number: should be a text item.
- wxWindow *m_propertyWindow = property->GetWindow();
- if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
- return FALSE;
-
- wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
-
- float val = 0.0;
- if (!StringToFloat(WXSTRINGCAST value, &val))
- {
- wxChar buf[200];
- wxSprintf(buf, T("Value %s is not a valid real number!"), (const wxChar *)value);
- wxMessageBox(buf, T("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
- return FALSE;
- }
-
- if (val < m_realMin || val > m_realMax)
- {
- wxChar buf[200];
- wxSprintf(buf, T("Value must be a real number between %.2f and %.2f!"), m_realMin, m_realMax);
- wxMessageBox(buf, T("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
- return FALSE;
- }
- return TRUE;
-}
-
-bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
- wxWindow *WXUNUSED(parentWindow) )
-{
- // The item used for viewing the real number: should be a text item.
- wxWindow *m_propertyWindow = property->GetWindow();
- if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
- return FALSE;
-
- wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
-
- if (value.Length() == 0)
- return FALSE;
-
- float f = (float)wxAtof((const wxChar *)value);
- property->GetValue() = f;
- return TRUE;
-}
-
-bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
- wxWindow *WXUNUSED(parentWindow) )
-{
- // The item used for viewing the real number: should be a text item.
- wxWindow *m_propertyWindow = property->GetWindow();
- if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
- return FALSE;
-
- wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
- textItem->SetValue(FloatToString(property->GetValue().RealValue()));
- return TRUE;