1. I desire my user do not enter more than 25 character in the editName widget. It is not enough that a pink colour appear. I desire that the widget refuse to write any character further the 25th. Is there such limitation?
not very elegant solution but works:
class EditStringLim : public EditString {
String str;
public:
typedef EditStringLim CLASSNAME;
void OnMax();
EditStringLim();
~EditStringLim() {;}
};
void EditStringLim::OnMax(){
if (GetLength()>=maxlen){ //bad! but if you make only >maxlen the value becomes <error ...
SetData(str);
SetSelection(maxlen, maxlen); //to avoid "selected all"
}
else
str = GetData().ToString(); //.Left(maxlen);
}
EditStringLim::EditStringLim(){
WhenAction=THISBACK(OnMax);
}
Any ideas how to make better?
Edit:
P.S. if you want to use your custom widgets with *.iml - paste or include them above
#define LAYOUTFILE "*.lay"
Well, I believe is that what forlano requests may not be desirable (at least, such limiting editing is very annoying in practice).