Applied patch [ 565012 ] Add wxTextValidator to wxTextEntryDialog
authorJulian Smart <julian@anthemion.co.uk>
Sun, 23 Jun 2002 13:51:32 +0000 (13:51 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 23 Jun 2002 13:51:32 +0000 (13:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

demos/forty/forty.rc
docs/changes.txt
docs/latex/wx/fdrepdlg.tex
include/wx/generic/textdlgg.h
src/generic/textdlgg.cpp

index 911ea25bb95f379c8be0373104095de98acbff2c..8457ac83a3eeaa8c42b270fc017ca161ed6d367f 100644 (file)
@@ -1,3 +1,5 @@
+aaaaa    ICON   "cards.ico"
+
 #include "wx/msw/wx.rc"
 
 CardsIcon    ICON   "cards.ico"
index 9a824a846333fe8c4348199b3b1607226a984698..c663752773b5cf3f25237b056696a038cfa67837 100644 (file)
@@ -208,6 +208,9 @@ All (GUI):
 - Added wxMouseCaptureChangedEvent
 - Added custom character filtering to wxTextValidator
 - wxTreeCtrl now supports incremental keyboard search
+- wxHelpProvider::RemoveHelp added and called from ~wxWindowBase
+  so that erroneous help strings are no longer found as the hash
+  table fills up
 
 wxMSW:
 
index a1cbe828e34ba2c318f64067b997661bf6e6e79b..e5e8be2eb5ff7c06a9651f02386760d329607693 100644 (file)
@@ -184,14 +184,14 @@ Set the replacement string (used as initial value by the dialog).
 \section{\class{wxFindReplaceDialog}}\label{wxfindreplacedialog}
 
 wxFindReplaceDialog is a standard modeless dialog which is used to allow the
-user to search for some text (and possible replace it with something else).
+user to search for some text (and possibly replace it with something else).
 The actual searching is supposed to be done in the owner window which is the
 parent of this dialog. Note that it means that unlike for the other standard
 dialogs this one {\bf must} have a parent window. Also note that there is no
-way to use this dialog in a modal way, it is always, by design and
+way to use this dialog in a modal way; it is always, by design and
 implementation, modeless.
 
-Please see the dialogs sample for example of using it.
+Please see the dialogs sample for an example of using it.
 
 \wxheading{Include files}
 
@@ -229,7 +229,6 @@ Destructor.
 Creates the dialog and shows it on screen.
 
 The {\it parent} and {\it data} parameters must be non-{\tt NULL}.
-
 \membersection{wxFindReplaceDialog::GetData}\label{wxfindreplacedialoggetdata}
 
 \constfunc{const wxFindReplaceData*}{GetData}{\void}
index 0b41fbaf93b5ca69616efc4719497ff23ecd3977..f68bd873af5d08069d21889d177e6be457275e6f 100644 (file)
 
 #include "wx/dialog.h"
 
+#if wxUSE_VALIDATORS
+#include "wx/valtext.h"
+#endif
+
 class WXDLLEXPORT wxTextCtrl;
 
 WXDLLEXPORT_DATA(extern const wxChar*) wxGetTextFromUserPromptStr;
 WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
 
-#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE)
+#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY)
 
 // ----------------------------------------------------------------------------
 // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons
@@ -44,6 +48,13 @@ public:
     void SetValue(const wxString& val);
     wxString GetValue() const { return m_value; }
 
+#if wxUSE_VALIDATORS
+    void SetTextValidator( wxTextValidator& validator );
+    void SetTextValidator( long style = wxFILTER_NONE );
+    wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); }
+#endif
+  // wxUSE_VALIDATORS
+
     // implementation only
     void OnOK(wxCommandEvent& event);
 
index 5eadd8e01812f50ed79c398b4ee53783686b53ff..4397306f2eb9031d64f7e5233517d108d264716f 100644 (file)
@@ -92,6 +92,12 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
                                 style & ~wxTextEntryDialogStyle);
     topsizer->Add( m_textctrl, 1, wxEXPAND | wxLEFT|wxRIGHT, 15 );
 
+#if wxUSE_VALIDATORS
+    wxTextValidator validator( wxFILTER_NONE, &m_value );
+    m_textctrl->SetValidator( validator );
+#endif
+  // wxUSE_VALIDATORS
+
 #if wxUSE_STATLINE
     // 3) static line
     topsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
@@ -115,9 +121,17 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
 
 void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
 {
+#if wxUSE_VALIDATORS
+    if( Validate() && TransferDataFromWindow() ) 
+    {
+        EndModal( wxID_OK );
+    }
+#else
     m_value = m_textctrl->GetValue();
 
     EndModal(wxID_OK);
+#endif
+  // wxUSE_VALIDATORS
 }
 
 void wxTextEntryDialog::SetValue(const wxString& val)
@@ -127,4 +141,19 @@ void wxTextEntryDialog::SetValue(const wxString& val)
     m_textctrl->SetValue(val);
 }
 
+#if wxUSE_VALIDATORS
+void wxTextEntryDialog::SetTextValidator( long style )
+{
+    wxTextValidator validator( style, &m_value );
+    m_textctrl->SetValidator( validator );
+}
+
+void wxTextEntryDialog::SetTextValidator( wxTextValidator& validator )
+{
+    m_textctrl->SetValidator( validator );
+}
+
+#endif
+  // wxUSE_VALIDATORS
+
 #endif // wxUSE_TEXTDLG