我正在与我的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 line\n");
detail->AppendText("Again a new line"); 我得到了:
一些文本◻◻,新行,◻◻,另一个新行,◻◻,又是一个新行
首先,我认为多行属性有问题,但是detail->IsMultiLine()返回true
任何帮助都将不胜感激,
发布于 2013-05-22 08:28:55
在构造对象时,必须指定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);https://stackoverflow.com/questions/16686244
复制相似问题