MCPcopy Create free account
hub / github.com/TankOs/SFGUI / SetMaximumLength

Method SetMaximumLength

src/SFGUI/Entry.cpp:346–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346void Entry::SetMaximumLength( int max_length ) {
347 SetCursorPosition( 0 );
348
349 m_max_length = max_length;
350
351 // Truncate text if longer than maximum.
352 if( m_max_length < static_cast<int>( m_string.getSize() ) && m_max_length != 0 ) {
353 m_string.erase( static_cast<std::size_t>( m_max_length ), static_cast<std::size_t>( m_max_length ) - m_string.getSize() );
354 RecalculateVisibleString();
355 GetSignals().Emit( OnTextChanged );
356 }
357}
358
359void Entry::SetTextMargin( float margin ) {
360 m_text_margin = margin;

Callers 2

RunMethod · 0.80
OnLimitCharsToggleMethod · 0.80

Calls 1

EmitMethod · 0.80

Tested by 2

RunMethod · 0.64
OnLimitCharsToggleMethod · 0.64