mkelly@cs.uoregon.edu (Michael A. Kelly) (12/20/90)
I've found a possible bug in CDesktop. The procedure RemoveWind is: void CDesktop::RemoveWind( CWindow *theWindow) /* Window object to remove */ { if (theWindow->IsVisible()) { HideWind(theWindow); /* Hide window before removing it */ } itsWindows->Remove(theWindow); } If this procedure removes the last window from the desktop, the CDesktop instance variable 'topWindow' should go to NIL, shouldn't it? It doesn't; it remains whatever it was before the call. I encountered this problem by making this call from a document: gApplication->itsDirectors->DisposeItems(); gDesktop->topWindow remained the same after the call. This eventually caused a crash, since the window had been disposed of. I changed RemoveWind to void CDesktop::RemoveWind( CWindow *theWindow) /* Window object to remove */ { if (theWindow->IsVisible()) { HideWind(theWindow); /* Hide window before removing it */ } itsWindows->Remove(theWindow); if ( itsWindows->numItems == 0 ) topWindow = NULL; } This has apparently fixed the problem, since the program no longer crashes. So, was the problem with CDesktop, or am I not doing something correctly? Also, is there a way to make a window completely ignore clicks other than overriding CDesktop::DispatchClick ? Thanks, Mike. -- Michael A. Kelly | "Fish heads, fish heads, Internet: mkelly@cs.uoregon.edu | Roly-poly fish heads, America Online: Michael792 | Fish heads, fish heads, Compu$erve: 73567,1651 | Eat them up, yum!" - Barnes & Barnes
Lawson.English@f15.n300.z1.fidonet.org (Lawson English) (12/24/90)
MK>> Also, is there a way to make a window completely ignore clicks MK>> other than overriding CDesktop::DispatchClick ? Now why would you want to do that... Also, as "SetWantsClicks" is part of the CView methods, and CWindow is a descendent of CView, why not just use "SetWantsClicks?" MK>> If this procedure removes the last window from the desktop, the MK>> CDesktop instance variable 'topWindow' should go to NIL, MK>> shouldn't it? It doesn't; it remains whatever it was before the MK>> call. The Think C manual suggests that one should never need to make these calls (RemoveWindow) directly. Are you doing this? Lawson -- Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15!Lawson.English Internet: Lawson.English@f15.n300.z1.fidonet.org