Gin
Public Member Functions | List of all members
SingleLineTextEditor::LengthAndCharacterRestriction Class Reference

An input filter for a TextEditor that limits the length of text and/or the characters that it may contain. More...

Inheritance diagram for SingleLineTextEditor::LengthAndCharacterRestriction:

Public Member Functions

 LengthAndCharacterRestriction (int maxNumChars, const juce::String &allowedCharacters)
 Creates a filter that limits the length of text, and/or the characters that it can contain. More...
 
juce::String filterNewText (SingleLineTextEditor &, const juce::String &) override
 This method is called whenever text is entered into the editor. More...
 
- Public Member Functions inherited from SingleLineTextEditor::InputFilter
 InputFilter ()
 
virtual ~InputFilter ()
 

Detailed Description

An input filter for a TextEditor that limits the length of text and/or the characters that it may contain.

Constructor & Destructor Documentation

◆ LengthAndCharacterRestriction()

SingleLineTextEditor::LengthAndCharacterRestriction::LengthAndCharacterRestriction ( int  maxNumChars,
const juce::String &  allowedCharacters 
)

Creates a filter that limits the length of text, and/or the characters that it can contain.

Parameters
maxNumCharsif this is > 0, it sets a maximum length limit; if <= 0, no limit is set
allowedCharactersif this is non-empty, then only characters that occur in this string are allowed to be entered into the editor.

Member Function Documentation

◆ filterNewText()

juce::String SingleLineTextEditor::LengthAndCharacterRestriction::filterNewText ( SingleLineTextEditor ,
const juce::String &  newInput 
)
overridevirtual

This method is called whenever text is entered into the editor.

An implementation of this class should should check the input string, and return an edited version of it that should be used.

Implements SingleLineTextEditor::InputFilter.


The documentation for this class was generated from the following file: