Invalidate() Error CDialog
-
Well, you could just resize it using SetWindowPos(), and then temporarily change the parent window to your CMainFrame I suppose. Another way might be to mimic the behavior of print preview, but without the printing so to speak.
Yet problem's not solved :confused:. Now you know I have two main class. calculator and tab_one(graphs). now calculator is formview and tab_one is dialog box. now everytime i change something in calculator i will need to redraw graphs in dialog box so i will call invalidate but dialog box will need to get new values from calculator, so i created instance of calculator in tab_one but everytime i call invalidate it creates new calculator and all values goes to default value thus not able to get new values. any clue ?
-
Yet problem's not solved :confused:. Now you know I have two main class. calculator and tab_one(graphs). now calculator is formview and tab_one is dialog box. now everytime i change something in calculator i will need to redraw graphs in dialog box so i will call invalidate but dialog box will need to get new values from calculator, so i created instance of calculator in tab_one but everytime i call invalidate it creates new calculator and all values goes to default value thus not able to get new values. any clue ?
Can't you just set a pointer to your main calculator in your tab_one dialog? Then you can read up-to-date data from the calculator when repainting your dialog. A better way would be to have a data object, containing all current information in your calculator. This should be owned by the calculator. Then set a pointer to this in your tab_one. Did that make sense?
-
Can't you just set a pointer to your main calculator in your tab_one dialog? Then you can read up-to-date data from the calculator when repainting your dialog. A better way would be to have a data object, containing all current information in your calculator. This should be owned by the calculator. Then set a pointer to this in your tab_one. Did that make sense?
i don't know if that makes sense or not but somehow i managed to solve that problem. What I did is. mytabcontrol was inside of calculator so whenever i changed something i inform that to mytabcontrol ( i have valid m_hWnd since it's inside calculator ) now all tabs are initialized inside tab control so they wont have problem getting m_hWnd for tabone so if they get called they will inform tab_one to redraw it(invalidate) now problems was if i calls tab_one from tabcontrol , then tab_one will be reinitialzed which will read defaults values of calculaotr so graph will be same. now i have calcparam which holds all values of calculator inside(calculator) and tab_one was reading those value. but now i created another calcparam inside tab_one and made sure tab_one read that calcparam not the one from calculator and if i change something in calculator. it does this memcpy( &m_tabMyTabCtrl.m_tabPages[i]->CalcParam,&CalcParam,sizeof(CALC_PARAMS)); m_tabMyTabCtrl.m_tabPages[i]->Invalidate( ); // m_tabmytabcontrol is instance of mytabcontrol inside gphview and tabpages is instance of tabone defined in mytabcontrol that's how i got it work. anyways thx a lot, cheers from canada.
-
i don't know if that makes sense or not but somehow i managed to solve that problem. What I did is. mytabcontrol was inside of calculator so whenever i changed something i inform that to mytabcontrol ( i have valid m_hWnd since it's inside calculator ) now all tabs are initialized inside tab control so they wont have problem getting m_hWnd for tabone so if they get called they will inform tab_one to redraw it(invalidate) now problems was if i calls tab_one from tabcontrol , then tab_one will be reinitialzed which will read defaults values of calculaotr so graph will be same. now i have calcparam which holds all values of calculator inside(calculator) and tab_one was reading those value. but now i created another calcparam inside tab_one and made sure tab_one read that calcparam not the one from calculator and if i change something in calculator. it does this memcpy( &m_tabMyTabCtrl.m_tabPages[i]->CalcParam,&CalcParam,sizeof(CALC_PARAMS)); m_tabMyTabCtrl.m_tabPages[i]->Invalidate( ); // m_tabmytabcontrol is instance of mytabcontrol inside gphview and tabpages is instance of tabone defined in mytabcontrol that's how i got it work. anyways thx a lot, cheers from canada.