Source code used is shown below.
namespace
{
const int ID_List = wxNewId();
};
BEGIN_EVENT_TABLE(Open_Tag_Log, wxEvtHandler)
//
END_EVENT_TABLE()
Open_Tag_Log ::Open_Tag_Log(const wxArrayString& Titles, wxArrayInt& Widths)
: ListCtrlLogger(Titles, Widths)
{
}
Open_Tag_Log::~Open_Tag_Log()
{
if (control && !Manager::IsAppShuttingDown())
{
control->RemoveEventHandler(this);
}
}
wxWindow* Open_Tag_Log::CreateControl(wxWindow* parent)
{
ListCtrlLogger::CreateControl(parent);
control->SetId(ID_List);
OpenTagLog.AppendToLog(_("Create Control Called"));
Connect(ID_List, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED,
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
&Open_Tag_Log::OnDoubleClick);
control->PushEventHandler(this);
return control;
}
void Open_Tag_Log::OnDoubleClick(wxCommandEvent &event)
{
// go to the relevant file/line
OpenTagLog.AppendToLog(_("Double Click"));
if (control->GetSelectedItemCount() == 0)
{
return;
}
// find selected item index
const int Index = control->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
SyncEditor(Index);
}