crashes when I pass data from dialog to View, Need help!
-
:(Hi there! I have MFC app (doc/view). In that app I have a dialog with a combobox from which I want to transfer a selected item back to the main View Class where I have a VTK(Visualization toolkit) window. basically Selecting an item in the combobox should affect the object that Im displaying in my main View when I execute my application and select the "Dialog" and select a string in the combobox it crashes and points at the member in the View class that I want to change. Below is the code where I change a variable in the View method SetScalars. I was wondering if it had to do with that my dialog is modal so that it cant overwrite my view class members , because that seems to be the problem. John, that line "alot of functions and members.... " are just VTK (vizualization toolkit) stuff. [CODE] void CStressesDialog::OnDropDownSelchange() { int idx = m_DropDown.GetCurSel(); if( idx < 0 ) return; CWnd* pParent = GetParent(); CVtkSDIView* pView = (CVtkSDIView*)pParent; pView = (CVtkSDIView*)pParent; CString str; m_DropDown.GetLBText( idx,str ); pView->SetScalars(str); } [/CODE] This is what causes the crash somehow this->str_select = s; where str_select is an Cstring. [CODE] void CVtkSDIView::SetScalars(CString s) { this->str_select = s; //VTK STUFF IN THIS FUNCTION.. this->filereader->SetScalarsName(str_select); this->filereader->Update(); this->lut->SetTableRange(this->filereader->GetOutput()->GetScalarRange()); this->lut->Build(); this->band->GenerateValues(15,this->filereader->GetOutput()->GetScalarRange()); this->band->Update(); this->pMapper->SetScalarRange(this->filereader->GetOutput()->GetScalarRange()); this->pMapper->Update(); this->renWin->Render(); this->iren->Start(); } [/CODE] Thanks for your help! /regards peter