Search code examples
c++wxwidgets

On wxTextCtrl max length callback


I've been working with wxTextCtrl and found one interesting thing. When I set max length as small number (250, 500, 10000) it works well. But when I put bigger numbers (20000, 100000), it doesn't work (I can go over the limit and no callback). Don't know how to fix it. Please, help.

wxWidgets 3.0.2

Windows

wxTextCtrl wxTE_BESTWRAP | wxTE_MULTILINE | wxBORDER_NONE | wxTE_AUTO_SCROLL | wxTE_AUTO_URL


Solution

  • Found in file textctrl.cpp, method

    bool wxTextCtrl::HasSpaceLimit(unsigned int *len) const
    

    line which makes everything

    return *len < 10001;