Compare commits
3 Commits
76be13001f
...
bcb56200c1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcb56200c1 | ||
|
|
0811c0eabb | ||
|
|
415d9ab518 |
@@ -77,7 +77,14 @@ void mainForm::OnNotify(Control* sender, EventArgs& args)
|
|||||||
// 表格增加一行数据
|
// 表格增加一行数据
|
||||||
tableView->InsertRow(rowCount);
|
tableView->InsertRow(rowCount);
|
||||||
tableView->SetRowData(rowCount, { L"uid" + std::to_wstring(rowCount), L"192.168.200.131\n127.0.0" , L"", L"2026-02-25"});
|
tableView->SetRowData(rowCount, { L"uid" + std::to_wstring(rowCount), L"192.168.200.131\n127.0.0" , L"", L"2026-02-25"});
|
||||||
// 获取表格指定位置数据
|
tableView->SetCellChecked(rowCount, 5, true);
|
||||||
|
tableView->SetCellComboIndex(rowCount, 2, 0);
|
||||||
|
|
||||||
|
// 改变单元格颜色
|
||||||
|
/*CellStyle style = tableView->GetCellStyle(1, 1);
|
||||||
|
style.SetBackColor(Color(200, 230, 155));
|
||||||
|
tableView->SetCellStyle(1, 1, style);*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -111,34 +118,37 @@ void mainForm::OnClose(bool& close)
|
|||||||
Application::Exit();
|
Application::Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
mainForm::mainForm() :LayeredWindow(1000, 750)
|
mainForm::mainForm() :LayeredWindow(1500, 750)
|
||||||
{
|
{
|
||||||
SetResizable(true); // 启用窗口大小调整
|
SetResizable(true); // 启用窗口大小调整
|
||||||
SetMiniSize(Size(600, 450)); // 设置最小尺寸
|
SetMiniSize(Size(600, 450)); // 设置最小尺寸
|
||||||
umg.LoadXml("res/mainForm.htm");//加载xml里面的控件与样式
|
umg.LoadXml("res/mainForm.htm");//加载xml里面的控件与样式
|
||||||
umg.SetupUI(this);
|
umg.SetupUI(this);
|
||||||
|
|
||||||
|
// 如果是debug模式则创建控制台窗口用于输出调试信息
|
||||||
|
#ifdef _DEBUG
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
FILE* fp = nullptr;
|
FILE* fp = nullptr;
|
||||||
freopen_s(&fp, "CONOUT$", "w", stdout);
|
freopen_s(&fp, "CONOUT$", "w", stdout);
|
||||||
freopen_s(&fp, "CONOUT$", "w", stderr);
|
freopen_s(&fp, "CONOUT$", "w", stderr);
|
||||||
|
std::cout << "调试模式控制台已启动!" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// 初始化设置表格各项属性
|
// 初始化设置表格各项属性
|
||||||
TableView* tableView = (TableView*)FindControl("tableViewAdmin"); //获取表格控件
|
TableView* tableView = (TableView*)FindControl("tableViewAdmin"); //获取表格控件
|
||||||
if (tableView) {
|
if (tableView) {
|
||||||
tableView->SelectedRowBackColor = Color(200, 230, 255); // 设置选中行背景色
|
tableView->SelectedRowBackColor = Color(200, 230, 255); // 设置选中行背景色
|
||||||
tableView->SetColumnType(5, ezui::CellType::CheckBox);
|
//tableView->SetColumnType(5, ezui::CellType::CheckBox);
|
||||||
tableView->SetColumnType(2, ezui::CellType::ComboBox);
|
tableView->SetColumnType(2, ezui::CellType::ComboBox); //设置第3列为下拉列表类型
|
||||||
tableView->SetColumnComboItems(2, { L"默认", L"禁止" , L"验机" });
|
tableView->SetColumnComboItems(2, { L"默认", L"禁止" , L"验机" }); //设置第3列下拉列表内容
|
||||||
tableView->SetDefaultTextAlign(Align::MiddleCenter);
|
tableView->SetDefaultTextAlign(Align::MiddleCenter); //设置默认对齐方式
|
||||||
|
|
||||||
//设置列宽
|
//设置列宽
|
||||||
std::vector<int> withs = {60, 120, 50, 90, 85, 85, 100, 70, 70, 80, 80, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90};
|
std::vector<int> withs = {60, 130, 55, 95, 85, 85, 105, 70, 75, 80, 80, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95 };
|
||||||
for(auto i=0;i< withs.size();i++)
|
for(int i = 0; i < withs.size(); i++)
|
||||||
tableView->SetColumnWidth(i, withs[i]);
|
tableView->SetColumnWidth(i, withs[i]);
|
||||||
|
|
||||||
|
|
||||||
// 鼠标右键单击的回调
|
// 鼠标右键单击的回调
|
||||||
tableView->RightClick = [tableView](int row, int col) {
|
tableView->RightClick = [tableView](int row, int col) {
|
||||||
int pRow = tableView->GetHoverRow(); //当前行号
|
int pRow = tableView->GetHoverRow(); //当前行号
|
||||||
@@ -150,7 +160,7 @@ mainForm::mainForm() :LayeredWindow(1000, 750)
|
|||||||
|
|
||||||
// 单元格编辑完成(编辑结束时触发,提供旧值与新值)
|
// 单元格编辑完成(编辑结束时触发,提供旧值与新值)
|
||||||
tableView->CellEditFinished = [](int row, int col, const UIString& oldValue, const UIString& newValue) {
|
tableView->CellEditFinished = [](int row, int col, const UIString& oldValue, const UIString& newValue) {
|
||||||
std::cout << "单元格内容: " << newValue.ansi() << ", " << oldValue.ansi() << std::endl;
|
std::cout << "完成编辑单元格内容: " << newValue.ansi() << ", " << oldValue.ansi() << std::endl;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace ezui {
|
|||||||
|
|
||||||
VListView m_list;
|
VListView m_list;
|
||||||
int m_index = -1;
|
int m_index = -1;
|
||||||
|
int m_pendingIndex = -1; // 延迟设置的索引(用于XML属性解析)
|
||||||
void Init();
|
void Init();
|
||||||
protected:
|
protected:
|
||||||
virtual void OnLayout()override;
|
virtual void OnLayout()override;
|
||||||
@@ -47,5 +48,7 @@ namespace ezui {
|
|||||||
//添加一个item并返回新item的下标
|
//添加一个item并返回新item的下标
|
||||||
int AddItem(const UIString& text);
|
int AddItem(const UIString& text);
|
||||||
void RemoveItem(int index);
|
void RemoveItem(int index);
|
||||||
|
//设置属性
|
||||||
|
virtual void SetAttribute(const UIString& key, const UIString& value)override;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -255,14 +255,29 @@ namespace ezui {
|
|||||||
// 选中行背景色(当第一列为CheckBox且被选中时使用,或者单击选中行时使用)
|
// 选中行背景色(当第一列为CheckBox且被选中时使用,或者单击选中行时使用)
|
||||||
Color SelectedRowBackColor = Color(0xFFADD8E6); // 浅蓝色
|
Color SelectedRowBackColor = Color(0xFFADD8E6); // 浅蓝色
|
||||||
|
|
||||||
|
/*
|
||||||
|
table->CellValueChanged = [](int row, int col, const UIString& value) {
|
||||||
|
// 处理内容变化
|
||||||
|
};
|
||||||
|
*/
|
||||||
// 单元格内容变化回调(内容变化时立即触发)
|
// 单元格内容变化回调(内容变化时立即触发)
|
||||||
// 参数: row, col, newValue
|
// 参数: row, col, newValue
|
||||||
std::function<void(int, int, const UIString&)> CellValueChanged = nullptr;
|
std::function<void(int, int, const UIString&)> CellValueChanged = nullptr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
table->CellEditFinished = [](int row, int col, const UIString& oldValue, const UIString& newValue) {
|
||||||
|
// 处理内容变化
|
||||||
|
};
|
||||||
|
*/
|
||||||
// 单元格编辑完成回调(编辑结束时触发,比如TextBox失去焦点或按Enter时)
|
// 单元格编辑完成回调(编辑结束时触发,比如TextBox失去焦点或按Enter时)
|
||||||
// 参数: row, col, oldValue, newValue
|
// 参数: row, col, oldValue, newValue
|
||||||
std::function<void(int, int, const UIString&, const UIString&)> CellEditFinished = nullptr;
|
std::function<void(int, int, const UIString&, const UIString&)> CellEditFinished = nullptr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
tableView->RightClick= [tableView](int row, int col) {
|
||||||
|
// 处理内容变化
|
||||||
|
};
|
||||||
|
*/
|
||||||
// 鼠标右键单击回调
|
// 鼠标右键单击回调
|
||||||
// 参数: row, col (row=-1 表示点击在表头,col=-1 表示点击在第一列)
|
// 参数: row, col (row=-1 表示点击在表头,col=-1 表示点击在第一列)
|
||||||
std::function<void(int, int)> RightClick = nullptr;
|
std::function<void(int, int)> RightClick = nullptr;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -32,6 +32,7 @@ namespace ezui {
|
|||||||
|
|
||||||
VListView m_list;
|
VListView m_list;
|
||||||
int m_index = -1;
|
int m_index = -1;
|
||||||
|
int m_pendingIndex = -1; // 延迟设置的索引(用于XML属性解析)
|
||||||
void Init();
|
void Init();
|
||||||
protected:
|
protected:
|
||||||
virtual void OnLayout()override;
|
virtual void OnLayout()override;
|
||||||
@@ -47,5 +48,7 @@ namespace ezui {
|
|||||||
//添加一个item并返回新item的下标
|
//添加一个item并返回新item的下标
|
||||||
int AddItem(const UIString& text);
|
int AddItem(const UIString& text);
|
||||||
void RemoveItem(int index);
|
void RemoveItem(int index);
|
||||||
|
//设置属性
|
||||||
|
virtual void SetAttribute(const UIString& key, const UIString& value)override;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -255,14 +255,29 @@ namespace ezui {
|
|||||||
// 选中行背景色(当第一列为CheckBox且被选中时使用,或者单击选中行时使用)
|
// 选中行背景色(当第一列为CheckBox且被选中时使用,或者单击选中行时使用)
|
||||||
Color SelectedRowBackColor = Color(0xFFADD8E6); // 浅蓝色
|
Color SelectedRowBackColor = Color(0xFFADD8E6); // 浅蓝色
|
||||||
|
|
||||||
|
/*
|
||||||
|
table->CellValueChanged = [](int row, int col, const UIString& value) {
|
||||||
|
// 处理内容变化
|
||||||
|
};
|
||||||
|
*/
|
||||||
// 单元格内容变化回调(内容变化时立即触发)
|
// 单元格内容变化回调(内容变化时立即触发)
|
||||||
// 参数: row, col, newValue
|
// 参数: row, col, newValue
|
||||||
std::function<void(int, int, const UIString&)> CellValueChanged = nullptr;
|
std::function<void(int, int, const UIString&)> CellValueChanged = nullptr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
table->CellEditFinished = [](int row, int col, const UIString& oldValue, const UIString& newValue) {
|
||||||
|
// 处理内容变化
|
||||||
|
};
|
||||||
|
*/
|
||||||
// 单元格编辑完成回调(编辑结束时触发,比如TextBox失去焦点或按Enter时)
|
// 单元格编辑完成回调(编辑结束时触发,比如TextBox失去焦点或按Enter时)
|
||||||
// 参数: row, col, oldValue, newValue
|
// 参数: row, col, oldValue, newValue
|
||||||
std::function<void(int, int, const UIString&, const UIString&)> CellEditFinished = nullptr;
|
std::function<void(int, int, const UIString&, const UIString&)> CellEditFinished = nullptr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
tableView->RightClick= [tableView](int row, int col) {
|
||||||
|
// 处理内容变化
|
||||||
|
};
|
||||||
|
*/
|
||||||
// 鼠标右键单击回调
|
// 鼠标右键单击回调
|
||||||
// 参数: row, col (row=-1 表示点击在表头,col=-1 表示点击在第一列)
|
// 参数: row, col (row=-1 表示点击在表头,col=-1 表示点击在第一列)
|
||||||
std::function<void(int, int)> RightClick = nullptr;
|
std::function<void(int, int)> RightClick = nullptr;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -111,13 +111,85 @@ namespace ezui {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return m_list.GetControls().size() - 1;
|
int newIndex = m_list.GetControls().size() - 1;
|
||||||
|
// 检查是否有待设置的索引
|
||||||
|
if (m_pendingIndex >= 0 && m_pendingIndex == newIndex) {
|
||||||
|
SetCheck(m_pendingIndex);
|
||||||
|
m_pendingIndex = -1; // 清除待设置标志
|
||||||
|
}
|
||||||
|
return newIndex;
|
||||||
}
|
}
|
||||||
void ComboBox::RemoveItem(int index)
|
void ComboBox::RemoveItem(int index)
|
||||||
{
|
{
|
||||||
Control* lb = m_list.GetControl(index);
|
Control* lb = m_list.GetControl(index);
|
||||||
m_list.Remove(lb, true);
|
m_list.Remove(lb, true);
|
||||||
}
|
}
|
||||||
|
void ComboBox::SetAttribute(const UIString& key, const UIString& value)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (key == "item") {
|
||||||
|
// 添加下拉选项,支持多个选项用逗号分隔
|
||||||
|
if (value.find(',') != UIString::npos) {
|
||||||
|
// 解析多个选项
|
||||||
|
size_t start = 0;
|
||||||
|
size_t end = value.find(',');
|
||||||
|
while (end != UIString::npos) {
|
||||||
|
UIString item = value.substr(start, end - start);
|
||||||
|
// 去除首尾空格
|
||||||
|
while (!item.empty() && (item[0] == ' ' || item[0] == '\t')) {
|
||||||
|
item = item.substr(1);
|
||||||
|
}
|
||||||
|
while (!item.empty() && (item[item.length() - 1] == ' ' || item[item.length() - 1] == '\t')) {
|
||||||
|
item = item.substr(0, item.length() - 1);
|
||||||
|
}
|
||||||
|
if (!item.empty()) {
|
||||||
|
AddItem(item);
|
||||||
|
}
|
||||||
|
start = end + 1;
|
||||||
|
end = value.find(',', start);
|
||||||
|
}
|
||||||
|
// 处理最后一个选项
|
||||||
|
UIString item = value.substr(start);
|
||||||
|
while (!item.empty() && (item[0] == ' ' || item[0] == '\t')) {
|
||||||
|
item = item.substr(1);
|
||||||
|
}
|
||||||
|
while (!item.empty() && (item[item.length() - 1] == ' ' || item[item.length() - 1] == '\t')) {
|
||||||
|
item = item.substr(0, item.length() - 1);
|
||||||
|
}
|
||||||
|
if (!item.empty()) {
|
||||||
|
AddItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 单个选项
|
||||||
|
AddItem(value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (key == "checked" || key == "selected" || key == "index") {
|
||||||
|
// 设置选中的下标
|
||||||
|
int index = std::atoi(value.c_str());
|
||||||
|
if (!SetCheck(index)) {
|
||||||
|
// 如果设置失败(可能是因为还没有添加item),保存索引稍后设置
|
||||||
|
m_pendingIndex = index;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (key == "readonly") {
|
||||||
|
// 设置文本框只读状态
|
||||||
|
if (value == "true") {
|
||||||
|
m_textBox.SetReadOnly(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (value == "false") {
|
||||||
|
m_textBox.SetReadOnly(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (false);
|
||||||
|
__super::SetAttribute(key, value);
|
||||||
|
}
|
||||||
void ComboBox::OnLayout() {
|
void ComboBox::OnLayout() {
|
||||||
this->m_UpDown.SetFixedSize(Size(Height(), Height()));
|
this->m_UpDown.SetFixedSize(Size(Height(), Height()));
|
||||||
__super::OnLayout();
|
__super::OnLayout();
|
||||||
|
|||||||
@@ -730,11 +730,35 @@ namespace ezui {
|
|||||||
|
|
||||||
void TableView::OffsetX(int offset) {
|
void TableView::OffsetX(int offset) {
|
||||||
m_scrollOffsetX = -offset;
|
m_scrollOffsetX = -offset;
|
||||||
|
|
||||||
|
// 如果正在编辑,更新编辑框位置
|
||||||
|
if (m_editing && m_editBox->IsVisible() && m_editRow >= 0 && m_editCol >= 0) {
|
||||||
|
if (m_editCol < (int)m_columns.size() && m_editRow < (int)m_rowHeights.size()) {
|
||||||
|
int x = GetColumnX(m_editCol);
|
||||||
|
int y = GetRowY(m_editRow);
|
||||||
|
int width = m_columns[m_editCol].Width;
|
||||||
|
int height = m_rowHeights[m_editRow];
|
||||||
|
m_editBox->SetRect(Rect(x, y, width, height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableView::OffsetY(int offset) {
|
void TableView::OffsetY(int offset) {
|
||||||
m_scrollOffsetY = -offset;
|
m_scrollOffsetY = -offset;
|
||||||
|
|
||||||
|
// 如果正在编辑,更新编辑框位置
|
||||||
|
if (m_editing && m_editBox->IsVisible() && m_editRow >= 0 && m_editCol >= 0) {
|
||||||
|
if (m_editCol < (int)m_columns.size() && m_editRow < (int)m_rowHeights.size()) {
|
||||||
|
int x = GetColumnX(m_editCol);
|
||||||
|
int y = GetRowY(m_editRow);
|
||||||
|
int width = m_columns[m_editCol].Width;
|
||||||
|
int height = m_rowHeights[m_editRow];
|
||||||
|
m_editBox->SetRect(Rect(x, y, width, height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "TextBox.h"
|
#include "TextBox.h"
|
||||||
#undef min
|
#undef min
|
||||||
#undef max
|
#undef max
|
||||||
namespace ezui {
|
namespace ezui {
|
||||||
@@ -374,7 +374,7 @@ namespace ezui {
|
|||||||
int innerW = std::max(0, Width() - (m_padLeft + m_padRight));
|
int innerW = std::max(0, Width() - (m_padLeft + m_padRight));
|
||||||
int innerH = std::max(0, Height() - (m_padTop + m_padBottom));
|
int innerH = std::max(0, Height() - (m_padTop + m_padBottom));
|
||||||
|
|
||||||
if (!m_autoWrap && !m_allowManualLineBreak) {//单行编辑框(两者都不允许)
|
if (!m_autoWrap) {//不自动换行时需要水平拖动滚动编辑框(两者都不允许)
|
||||||
m_font->Get()->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
|
m_font->Get()->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
|
||||||
bool bAlignLeft = (int(this->TextAlign) & int(HAlign::Left));
|
bool bAlignLeft = (int(this->TextAlign) & int(HAlign::Left));
|
||||||
float width = bAlignLeft ? EZUI_FLOAT_MAX : (float)innerW;
|
float width = bAlignLeft ? EZUI_FLOAT_MAX : (float)innerW;
|
||||||
@@ -436,7 +436,8 @@ namespace ezui {
|
|||||||
m_careRect.Height = m_textLayout->GetFontHeight();
|
m_careRect.Height = m_textLayout->GetFontHeight();
|
||||||
m_careRect.Width = 1 * this->GetScale();
|
m_careRect.Width = 1 * this->GetScale();
|
||||||
|
|
||||||
if (!m_autoWrap && !m_allowManualLineBreak) {
|
// 处理水平滚动(当不自动换行时需要水平滚动)
|
||||||
|
if (!m_autoWrap) {
|
||||||
// 使光标保持在可视内区(考虑 padding)
|
// 使光标保持在可视内区(考虑 padding)
|
||||||
int innerW = std::max(0, Width() - (m_padLeft + m_padRight));
|
int innerW = std::max(0, Width() - (m_padLeft + m_padRight));
|
||||||
int caretDrawX = m_careRect.X + m_scrollX; // 布局坐标 + 滚动
|
int caretDrawX = m_careRect.X + m_scrollX; // 布局坐标 + 滚动
|
||||||
@@ -448,7 +449,9 @@ namespace ezui {
|
|||||||
m_scrollX += offsetX;
|
m_scrollX += offsetX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // 多行:处理垂直滚动保持光标可见
|
|
||||||
|
// 处理垂直滚动(多行模式需要垂直滚动)
|
||||||
|
if (m_autoWrap || m_allowManualLineBreak) {
|
||||||
int innerH = std::max(0, Height() - (m_padTop + m_padBottom));
|
int innerH = std::max(0, Height() - (m_padTop + m_padBottom));
|
||||||
int caretDrawY = m_careRect.Y + m_scrollY; // 仅布局+滚动
|
int caretDrawY = m_careRect.Y + m_scrollY; // 仅布局+滚动
|
||||||
if (caretDrawY < 0) {
|
if (caretDrawY < 0) {
|
||||||
@@ -492,7 +495,7 @@ namespace ezui {
|
|||||||
void TextBox::OnMouseWheel(const MouseEventArgs& arg)
|
void TextBox::OnMouseWheel(const MouseEventArgs& arg)
|
||||||
{
|
{
|
||||||
__super::OnMouseWheel(arg);
|
__super::OnMouseWheel(arg);
|
||||||
if (!m_autoWrap && !m_allowManualLineBreak) {//单行
|
if (!m_autoWrap) {//不自动换行时需要水平拖动滚动
|
||||||
int innerW = std::max(0, Width() - (m_padLeft + m_padRight));
|
int innerW = std::max(0, Width() - (m_padLeft + m_padRight));
|
||||||
int textWidth = m_fontBox.Width;
|
int textWidth = m_fontBox.Width;
|
||||||
if (arg.ZDelta > 0 && textWidth > innerW) {
|
if (arg.ZDelta > 0 && textWidth > innerW) {
|
||||||
@@ -560,7 +563,7 @@ namespace ezui {
|
|||||||
|
|
||||||
BuildSelectedRect();
|
BuildSelectedRect();
|
||||||
|
|
||||||
if (!m_autoWrap && !m_allowManualLineBreak) {//单行
|
if (!m_autoWrap) {//不自动换行时需要水平拖动滚动
|
||||||
// 计算去掉左 padding 的鼠标相对文本区域坐标
|
// 计算去掉左 padding 的鼠标相对文本区域坐标
|
||||||
int innerW = std::max(0, Width() - (m_padLeft + m_padRight));
|
int innerW = std::max(0, Width() - (m_padLeft + m_padRight));
|
||||||
int textWidth = m_fontBox.Width;
|
int textWidth = m_fontBox.Width;
|
||||||
@@ -757,8 +760,8 @@ namespace ezui {
|
|||||||
}
|
}
|
||||||
if (key == "multiline") {
|
if (key == "multiline") {
|
||||||
if (value == "true") {
|
if (value == "true") {
|
||||||
// 兼容旧版:multiline=true 表示自动换行+手动换行
|
// 兼容旧版:multiline=true 表示不自动换行+手动换行
|
||||||
this->m_autoWrap = true;
|
this->m_autoWrap = false;
|
||||||
this->m_allowManualLineBreak = true;
|
this->m_allowManualLineBreak = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user