Commit 8bb536de73cdf6b733c91ffccaef7a07feeb83b5

Authored by Steve Greedy
1 parent 7ba34678

Resolved issue re-selected MOD

Disconnect events attached to previous tree.
Showing 1 changed file with 12 additions and 4 deletions   Show diff stats
GUI/SW1/SRC/SW1_GUIMain.cpp
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 // It was developed by the University of Nottingham and the Netherlands Aerospace 4 // It was developed by the University of Nottingham and the Netherlands Aerospace
5 // Centre (NLR) for ESA under contract number 4000112765/14/NL/HK. 5 // Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
6 // 6 //
7 -// Copyright (C) 2015 - 2018 University of Nottingham 7 +// Copyright (C) 2015 - 2017 University of Nottingham
8 // 8 //
9 // SACAMOS is free software: you can redistribute it and/or modify it under the 9 // SACAMOS is free software: you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the Free Software 10 // terms of the GNU General Public License as published by the Free Software
@@ -215,6 +215,7 @@ SW1_GUIFrame::SW1_GUIFrame(wxWindow* parent,wxWindowID id) @@ -215,6 +215,7 @@ SW1_GUIFrame::SW1_GUIFrame(wxWindow* parent,wxWindowID id)
215 Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SW1_GUIFrame::OnAbout); 215 Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SW1_GUIFrame::OnAbout);
216 //*) 216 //*)
217 217
  218 +
218 // Set frame icon here 219 // Set frame icon here
219 wxIcon FrameIcon; 220 wxIcon FrameIcon;
220 FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("resources/spacewire_schematic_64x64.ico")))); 221 FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("resources/spacewire_schematic_64x64.ico"))));
@@ -335,16 +336,23 @@ void SW1_GUIFrame::OnCreateMOD(wxCommandEvent& event) @@ -335,16 +336,23 @@ void SW1_GUIFrame::OnCreateMOD(wxCommandEvent& event)
335 void SW1_GUIFrame::PopulateTheDirectoryTree ( wxString RootFolder) 336 void SW1_GUIFrame::PopulateTheDirectoryTree ( wxString RootFolder)
336 { 337 {
337 int size_h, size_v; 338 int size_h, size_v;
338 - Panel1->GetSize(&size_h, &size_v );  
339 339
340 if (tree != NULL) 340 if (tree != NULL)
341 - tree->Destroy(); 341 + {
  342 + Disconnect(tree->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_SEL_CHANGED , (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &SW1_GUIFrame::OnTreeSelection);
  343 + Disconnect(tree->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_ITEM_ACTIVATED, (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &SW1_GUIFrame::OnTreeSelectionChanged);
  344 + tree -> Close();
  345 + tree -> Destroy();
  346 + }
  347 +
342 348
343 tree = (wxSpecificDirCtrl *) NULL; 349 tree = (wxSpecificDirCtrl *) NULL;
344 350
  351 + Panel1->GetSize(&size_h, &size_v );
  352 +
345 tree = new wxSpecificDirCtrl (Panel1, -1, RootFolder, 353 tree = new wxSpecificDirCtrl (Panel1, -1, RootFolder,
346 wxDefaultPosition, 354 wxDefaultPosition,
347 - wxSize(size_h,size_v), 355 + wxSize(-1,-1),
348 wxSIMPLE_BORDER, 356 wxSIMPLE_BORDER,
349 "*.cable_spec;*.bundle_spec;*.spice_model_spec", 0, 357 "*.cable_spec;*.bundle_spec;*.spice_model_spec", 0,
350 _T("Directory Listing")); 358 _T("Directory Listing"));