Author Topic: Why my wxListCtrl code could not work??  (Read 4521 times)

dbtsai

  • Guest
Why my wxListCtrl code could not work??
« on: February 18, 2006, 08:19:55 pm »
Dear all,

The following are my code.
and I have an wxTextCtrl in my driven class from wxListCtrl.

And I want when I change wxTextCtrl, and event will generate,
and call a member function in my MyPanel_file_text_list.

But the following code seem does not call the member function.

What wrong with it??

Thanks..

Code
class MyPanel_file_text_list : public wxListCtrl
{
public:
   MyPanel_file_text_list(wxWindow* parent,
                   wxWindowID id,
                   const wxPoint& pos,
                   const wxSize& size,long style);

       void SetDir(wxCommandEvent& event);

private:
   wxTextCtrl* g_dir_text;
   wxString g_path;

protected:
   DECLARE_EVENT_TABLE()
};

Code
BEGIN_EVENT_TABLE(MyPanel_file_text_list, wxListCtrl)
   EVT_TEXT_ENTER(ID_MyPanel_file_text_enter_path, MyPanel_file_text_list::SetDir)
END_EVENT_TABLE()

Code
MyPanel_file_text_list::MyPanel_file_text_list
(wxWindow* parent, wxWindowID id,  const wxPoint& pos,
const wxSize& size,long style)
: wxListCtrl( parent, id, pos+wxPoint(0,30), size, style)
{
   wxListItem itemCol; itemCol.SetText(wxT("檔名"));
   this->InsertColumn(0, itemCol);
   this->SetColumnWidth(0, 200);
   this->g_dir_text = new wxTextCtrl(parent,               ID_MyPanel_file_text_enter_path,
           wxEmptyString,
           pos,wxDefaultSize,
           wxTE_PROCESS_ENTER);
}

void MyPanel_file_text_list::SetDir(wxCommandEvent& event)
{             cout << "test";
}

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: Why my wxListCtrl code could not work??
« Reply #1 on: February 18, 2006, 10:47:51 pm »
May I ask how this is related to C::B?
Please, don't get me wrong, but if you have questions about wxWidgets programming you might better ask in a "true" wxWidgets forum, such as http://wxforum.shadonet.com.
Hence there might still be somebody around here that can answer your question...
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

takeshimiya

  • Guest
Re: Why my wxListCtrl code could not work??
« Reply #2 on: February 19, 2006, 02:39:17 pm »
MortenMacFly is right. But could you replace the
Code: cpp
cout << "test";
with
Code: cpp
wxMessageBox(wxT("test"));
?