wxTextCtrl新行问题
wxTextCtrl new line issues
我正在与wxTextCtrl的恼人问题作斗争。无论我怎么尝试,都没有办法添加新的一行。wxTextCtrl显示一个方框字符,而不是一个新的行。
以下是相关代码:
wxTextCtrl * detail = new wxTextCtrl (this,wxID_ANY);
detail->SetWindowStyle(wxTE_MULTILINE);
detail->SetEditable(false);
detail->AppendText("Some text");
detail->AppendText("n New line");
detail->AppendText("n An other new linen");
detail->AppendText("Again a new line");
我得到:
一些文本◻◻◻◻另一个新行◻◻又是一个新行
首先我认为有一个问题与Multiline属性,但detail->IsMultiLine()
返回true
在构造对象时必须指定Multiline属性。
wxWidgets文档中特别提到了这一点:
Note that alignment styles (wxTE_LEFT, wxTE_CENTRE and wxTE_RIGHT) can be changed dynamically after control creation on wxMSW and wxGTK. wxTE_READONLY, wxTE_PASSWORD and wrapping styles can be dynamically changed under wxGTK but not wxMSW. The other styles can be only set during control creation.
代替:
detail->SetWindowStyle(wxTE_MULTILINE);
这个应该可以工作:
wxTextCtrl(this,wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
相关文章:
- 使用新行和不使用新行读取文件
- 遇到新行时,有没有办法停止istream_iterator
- PangoLayout 中忽略的新行
- 使用 clang 格式时,当行很大时,如何将右括号分成新行?
- 如何检测将文本文件读入 int 数组的新行
- 当 getline 直到新行才读取时会发生什么?
- 添加新行时工作代码引发异常.调试技巧?
- QTree查看新行,没有布局就不可见已更改
- 新行上的 clang 格式右括号
- C++流:保存到新行而不是覆盖旧行
- (C++) 使用诅咒打印从文件中读入的新行
- 按升序输出整数时,将最后一个整数放在新行上
- 用C++计算输入文本的新行数
- 为什么我的代码在终端中没有输出任何内容.开始新行没有错误
- WriteConsoleOutputCharacterW - 我的新行在哪里?
- 为什么当测试用例数为 1 时,我的程序不输入而是打印新行?
- 如何运行 while 循环直到到达新行?
- C++将字符串写入文本文件中的行;新行问题不起作用
- wxTextCtrl新行问题
- 如何解决javascript的CPP中的新行问题