Skip to main content
ferro
Lead
Mar 10, 2023 2:32 PM UTC
Question

Is TextArea::getBaselineY() not implemented by desing ?

Hi,

As the TextArea::setBaselineY() is not mirrored with a getter TextArea::getBaselineY() I wonder whether it is a design decision or simply overlook.

Thanks

This topic has been closed for replies.

2 replies

Osman SOYKURT
ST Technical Moderator
Mar 14, 2023 2:36 PM UTC

Hello ferro,

Actually the setBaseline() function will move the widget entirely, so getting a value like this would not be different than getting your widget Y-position. This is not the same for the setIndentation() function however, where only the text will "move" and not the widget.

/Osman

ST Software Developer | TouchGFX
ferro
ferroAuthor
Lead
Mar 15, 2023 11:29 AM UTC

Hi @Osman SOYKURT​ 

"Actually the setBaseline() function will move the widget entirely"

Yes ! I realized that while tinkering with a vertical alignment.

"getting a value like this [ getBaseline () ] would not be different than getting your widget Y-position"

I think the hypothetical getBaseline () sbould differ from getY() by getTypedText().getFont()->getBaseline() as

//TextArea.hpp
 
virtual void TextArea::setBaselineY(int16_t baselineY)
{
 setY(baselineY - getTypedText().getFont()->getBaseline());
}