News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Why my wxListCtrl code could not work??

Started by dbtsai, February 18, 2006, 08:19:55 PM

Previous topic - Next topic

dbtsai

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..


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()
};



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()



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";
}

MortenMacFly

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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

takeshimiya

MortenMacFly is right. But could you replace the
Code (cpp) Select
cout << "test"; with
Code (cpp) Select
wxMessageBox(wxT("test")); ?