R
rsd911
The following MDI Form only allows me to type one character in the
TreeNode's edit control unless the child window is focused in a Normal
(or Maximized) WindowState.
After entering one character the child form is appears to receive
focus, ending the edit operation. If there is more than one MDI child,
then the first child receives focus and is brought to front.
How can I fix this?
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::TreeView^ treeView1;
private: System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->treeView1 = (gcnew
System::Windows::Forms::TreeView());
this->SuspendLayout();
//
// treeView1
//
this->treeView1->Dock =
System::Windows::Forms:ockStyle::Left;
this->treeView1->LabelEdit = true;
this->treeView1->Location = System:rawing:oint(0, 0);
this->treeView1->Name = L"treeView1";
this->treeView1->Size = System:rawing::Size(200, 471);
this->treeView1->TabIndex = 0;
//
// Form1
//
this->AutoScaleDimensions = System:rawing::SizeF(6, 13);
this->AutoScaleMode =
System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System:rawing::Size(696, 471);
this->Controls->Add(this->treeView1);
this->IsMdiContainer = true;
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this,
&Form1::Form1_Load);
this->ResumeLayout(false);
}
#pragma endregion
private:
System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
Form^ f = gcnew Form();
f->MdiParent = this;
f->Show();
f->WindowState = FormWindowState::Minimized;
TreeNode^ tn = this->treeView1->Nodes->Add("Top1");
tn->Nodes->Add("sub1");
tn->Nodes->Add("sub2");
tn = this->treeView1->Nodes->Add("Top2");
tn->Nodes->Add("sub3");
tn->Nodes->Add("sub4");
tn->Nodes->Add("sub5");
tn = this->treeView1->Nodes->Add("Top3");
tn->Nodes->Add("sub6");
tn->Nodes->Add("sub7");
tn->Nodes->Add("sub8");
this->treeView1->ExpandAll();
}
};
TreeNode's edit control unless the child window is focused in a Normal
(or Maximized) WindowState.
After entering one character the child form is appears to receive
focus, ending the edit operation. If there is more than one MDI child,
then the first child receives focus and is brought to front.
How can I fix this?
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::TreeView^ treeView1;
private: System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->treeView1 = (gcnew
System::Windows::Forms::TreeView());
this->SuspendLayout();
//
// treeView1
//
this->treeView1->Dock =
System::Windows::Forms:ockStyle::Left;
this->treeView1->LabelEdit = true;
this->treeView1->Location = System:rawing:oint(0, 0);
this->treeView1->Name = L"treeView1";
this->treeView1->Size = System:rawing::Size(200, 471);
this->treeView1->TabIndex = 0;
//
// Form1
//
this->AutoScaleDimensions = System:rawing::SizeF(6, 13);
this->AutoScaleMode =
System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System:rawing::Size(696, 471);
this->Controls->Add(this->treeView1);
this->IsMdiContainer = true;
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this,
&Form1::Form1_Load);
this->ResumeLayout(false);
}
#pragma endregion
private:
System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
Form^ f = gcnew Form();
f->MdiParent = this;
f->Show();
f->WindowState = FormWindowState::Minimized;
TreeNode^ tn = this->treeView1->Nodes->Add("Top1");
tn->Nodes->Add("sub1");
tn->Nodes->Add("sub2");
tn = this->treeView1->Nodes->Add("Top2");
tn->Nodes->Add("sub3");
tn->Nodes->Add("sub4");
tn->Nodes->Add("sub5");
tn = this->treeView1->Nodes->Add("Top3");
tn->Nodes->Add("sub6");
tn->Nodes->Add("sub7");
tn->Nodes->Add("sub8");
this->treeView1->ExpandAll();
}
};