Click here to Skip to main content
16,004,969 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblems with screen redrawing [modified] Pin
kildareflare10-Jun-08 0:17
kildareflare10-Jun-08 0:17 
AnswerRe: Problems with screen redrawing Pin
Rage10-Jun-08 0:52
professionalRage10-Jun-08 0:52 
GeneralRe: Problems with screen redrawing Pin
kildareflare10-Jun-08 1:47
kildareflare10-Jun-08 1:47 
AnswerRe: Problems with screen redrawing Pin
Cedric Moonen10-Jun-08 0:58
Cedric Moonen10-Jun-08 0:58 
GeneralRe: Problems with screen redrawing Pin
kildareflare10-Jun-08 1:57
kildareflare10-Jun-08 1:57 
AnswerRe: Problems with screen redrawing Pin
Jagdish V. Bhimbha10-Jun-08 5:16
Jagdish V. Bhimbha10-Jun-08 5:16 
AnswerRe: Problems with screen redrawing Pin
Mark Salsbery10-Jun-08 6:14
Mark Salsbery10-Jun-08 6:14 
GeneralPROBLEM FIXED [modified] Pin
kildareflare11-Jun-08 1:09
kildareflare11-Jun-08 1:09 
Hello All

I've found the solution to the problem, thoug not sure exactly why.

Since the "explorer" view allways drew itself correctly when the application is first started and also when resizing the view I guessed that one difference is that the problem occurs when trying to update the view while it is not in focus - i.e. minimized.

Figuring that there must be something different in the two scenarios I checked the InitialiseTreeCtrl method. The only extra code completed here that was not called when the window was minimized was a call to destroy and then recreate the control.

I found that I needed to call the above function prior to calling setFocus() and UpdateWindow(). This appears to resolve the problem.
I have moved the calls to SetFocus and UpdateWindow from the overriden OnDraw method to my mainFrames Move method, since this is called when the window is minimized/maximized.

So the code required to fix this is below:
workspacewindow is derived from CSizingTabCtrlBar

After getting a pointer to the view on which the explorer window lies I have to:
1) Initialize the tree (destroy it and creat again, resize as appropriate and assign image list)
2) Update the tree (insert items from list, expand and ensure visibile)
3) Invalidate ctrl
4) Give the view and so control focus
5) Update the window
void CMainFrame::OnMove(int x, int y)
{
 ///.......///

CWorkspaceWindowTab2View* pWorkspaceTab2View = (CWorkspaceWindowTab2View*)((CMainFrame*)theApp.m_pMainWnd)->m_pWorkspaceWindow->GetView(EXPLORER_VIEW);

	pWorkspaceTab2View->InitializeLoopBrowserTree(); 
	pWorkspaceTab2View->UpdateLoopBrowserTree();
	pWorkspaceTab2View->GetDlgItem(IDC_LOOPS_TREE)->Invalidate(TRUE);
	pWorkspaceTab2View->SetFocus();
	pWorkspaceTab2View->UpdateWindow();
}




Although, I have just noticed that occasionly when changing views using the tabcontrol this view is not updated. I can "fix" this also by placing a call to the InitialiseTreeCtrl method in the CSizingTabCtrlBar::SetActiveView method, however this of course breaks a few rules...any other suggetions...?

Thanks
Rich



modified on Wednesday, June 11, 2008 8:29 AM

QuestionCustom Control vs. Owner Draw Control? Pin
sawerr9-Jun-08 23:56
sawerr9-Jun-08 23:56 
AnswerRe: Custom Control vs. Owner Draw Control? Pin
Rage10-Jun-08 0:50
professionalRage10-Jun-08 0:50 
AnswerRe: Custom Control vs. Owner Draw Control? Pin
Joe Woodbury10-Jun-08 6:17
professionalJoe Woodbury10-Jun-08 6:17 
GeneralRe: Custom Control vs. Owner Draw Control? Pin
sawerr10-Jun-08 7:13
sawerr10-Jun-08 7:13 
GeneralRe: Custom Control vs. Owner Draw Control? Pin
Joe Woodbury10-Jun-08 7:58
professionalJoe Woodbury10-Jun-08 7:58 
QuestionVC++ Toolkit 2003 warning message Pin
rp_suman9-Jun-08 22:45
rp_suman9-Jun-08 22:45 
AnswerRe: VC++ Toolkit 2003 warning message Pin
Alan Balkany10-Jun-08 4:23
Alan Balkany10-Jun-08 4:23 
GeneralRe: VC++ Toolkit 2003 warning message Pin
rp_suman10-Jun-08 14:03
rp_suman10-Jun-08 14:03 
QuestionHelp with navigate2 error Pin
limesp9-Jun-08 22:44
limesp9-Jun-08 22:44 
AnswerRe: Help with navigate2 error Pin
CPallini9-Jun-08 23:07
mveCPallini9-Jun-08 23:07 
QuestionConvert CComPtr<istream> into ostream</istream> Pin
CodingLover9-Jun-08 22:27
CodingLover9-Jun-08 22:27 
Answeristream to ostream? Pin
CPallini9-Jun-08 22:46
mveCPallini9-Jun-08 22:46 
QuestionRe: istream to ostream? Pin
CodingLover9-Jun-08 22:49
CodingLover9-Jun-08 22:49 
QuestionLength of IStream Pin
CodingLover10-Jun-08 0:18
CodingLover10-Jun-08 0:18 
QuestionCreateThread parameter Pin
rp_suman9-Jun-08 22:23
rp_suman9-Jun-08 22:23 
AnswerRe: CreateThread parameter PinPopular
Cedric Moonen9-Jun-08 22:26
Cedric Moonen9-Jun-08 22:26 
GeneralRe: CreateThread parameter Pin
rp_suman9-Jun-08 22:41
rp_suman9-Jun-08 22:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.