add:添加输出目录函数绑定。

This commit is contained in:
taynpg 2024-08-06 10:30:05 +08:00
parent 5e790a63ba
commit 4c8f80dde8
2 changed files with 15 additions and 3 deletions

View File

@ -29,16 +29,17 @@ void CMainPanel::InitPanel()
sizer_select_->Add(btn_select_, 0, wxALL | wxALIGN_LEFT, g_Border);
// 将水平 sizer 添加到带标题的 sizer 中, wxALIGN_CENTER_VERTICAL 仅水平可用
base_box_sizer_->Add(label_select_, 0, wxALL, g_Border);
base_box_sizer_->Add(label_select_, 0, wxALL | wxEXPAND, g_Border);
base_box_sizer_->Add(sizer_select_, 0, wxALL | wxEXPAND, g_Border);
sizer_output_ = new wxBoxSizer(wxHORIZONTAL);
btn_output_ = new wxButton(this, wxID_ANY, wxT("选择目录"));
btn_output_->Bind(wxEVT_BUTTON, &CMainPanel::selectDir, this);
text_output_ctrl_ = new wxTextCtrl(this, wxID_ANY);
label_output_ = new wxStaticText(this, wxID_ANY, wxT("输出目录:"));
base_box_sizer_->Add(label_output_, 0, wxALL, g_Border);
base_box_sizer_->Add(label_output_, 0, wxALL| wxEXPAND, g_Border);
sizer_output_->Add(text_output_ctrl_, 1, wxALL, g_Border);
sizer_output_->Add(text_output_ctrl_, 1, wxALL | wxEXPAND, g_Border);
sizer_output_->Add(btn_output_, 0, wxALL, g_Border);
base_box_sizer_->Add(sizer_output_, 0, wxALL | wxEXPAND, g_Border);
@ -75,6 +76,16 @@ void CMainPanel::InitPanel()
SetSizer(top_sizer_);
}
void CMainPanel::selectDir(wxCommandEvent& event)
{
wxDirDialog dirDialog(this, wxT("Select Directory"), wxEmptyString, wxDD_DIR_MUST_EXIST);
if (dirDialog.ShowModal() == wxID_CANCEL) return; // 用户取消选择
wxString selectedDir = dirDialog.GetPath();
text_output_ctrl_->SetValue(selectedDir);
}
void CMainPanel::genResult(wxCommandEvent& event)
{
wxArrayString arrayStrings;

View File

@ -44,6 +44,7 @@ public:
private:
void selectBinaryFile(wxCommandEvent& event);
void selectDir(wxCommandEvent& event);
void addEnv(wxCommandEvent& event);
void delEnv(wxCommandEvent& event);
void genResult(wxCommandEvent& event);