feat: add a new awesome feature

This commit is contained in:
Ysm-04
2025-09-30 19:26:01 +08:00
parent 741987e48b
commit 26f30cee39
3 changed files with 15 additions and 1 deletions

View File

@@ -5,7 +5,11 @@ StellarX 项目所有显著的变化都将被记录在这个文件中。
格式基于 [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
并且本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
## [v2.0.1] - 2025 - 09 - 30
### 新增
- 文本框新增`setText`接口,可在外部设置文本框内容
## [v2.0.0] - 2025-09-21

View File

@@ -50,6 +50,8 @@ public:
void setTextBoxBorder(COLORREF color);
//设置背景颜色
void setTextBoxBk(COLORREF color);
//设置文本
void setText(std::string text);
//获取文本
std::string getText() const;

View File

@@ -140,6 +140,14 @@ void TextBox::setTextBoxBk(COLORREF color)
this->dirty = true;
}
void TextBox::setText(std::string text)
{
if(text.size() > maxCharLen)
text = text.substr(0, maxCharLen);
this->text = text;
this->dirty = true;
}
std::string TextBox::getText() const
{
return this->text;