[wxTextCtrl] unwanted selection

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
MoonKid
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am
Contact:

[wxTextCtrl] unwanted selection

Post by MoonKid » Thu May 14, 2009 8:59 am

I am using wxSVN on WinXP SP3 with MSVC2008 ExpEd.

I create a wxDialog with a wxTextCtrl (wxRICH2) in it and write text to it. The problem is that the text in the control is still selected.
I don't know why.

This is the simplified code

Code: Select all

void WXCCrontabEditDlg::Init ()
{
  wxString strCrontabContent;

  ReadCrontab(strCrontabContent);

  // create the text control
  pCtrl_ = new wxTextCtrl(this, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_RICH2);

  // arrange
  wxSizer* pSizer = new wxBoxSizer(wxVERTICAL);
  pSizer->Add(pCtrl_, wxSizerFlags(1).Expand());
  SetSizer(pSizer);
  Center();

  //
  pCtrl_->WriteText(strCrontabContent);
  pCtrl_->DiscardEdits();
  pCtrl_->SetInsertionPointEnd();
}

Post Reply