je cree un TextValidator :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <wx/valtext.h>
 
class MonValidateurTexte: public wxTextValidator
{
private :
	int deb;
	int fin;
	int* dmetier;
	wxString * saisie;
public:
	MonValidateurTexte(int , int  , wxString * ,int *);
	MonValidateurTexte(const wxTextValidator& validator);
	wxTextValidator* Clone() const;
	bool Validate(wxWindow* parent);
	virtual bool TransferToWindow();
	virtual bool TransferFromWindow();
};
dans une class wxPanel (Operande) je veux cree le validateur sur un wxTextCtrl :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
wxString mTexteop = new wxString(wxEmptyString);
MonValidateurTexte validatorTextop = 
             new MonValidateurTexte(0,20,mTexteop,valop );
wxTextCtrl textCtrlop = 
    new wxTextCtrl(this,ID_TEXT_CTRL_OP, *mTexteop ,wxDefaultPosition, 
                   wxSize(35,30),0,*validatorTextop);
donc apres je défini un evenement sur mon wxPanel :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
void Operande::OnTexteValide(wxCommandEvent &e)
{
		validatorTextop->Validate(this);
		validatorTextop->TransferFromWindow();
		validatorTextop->TransferToWindow();
}
donc premier plantage sur la premiere ligne : validatorTextop->Validate(this);

message d'alerte : wxWidgets Debug Alert
..\..\include\wx/valtext.h(106): assert "wxAssertFailure" failed : No window associated with validator.

BESOIN D'AIDE SVP