Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!apple!mdtaylor From: mdtaylor@Apple.COM (Mark David Taylor) Newsgroups: comp.sys.mac.programmer Subject: Re: Another C++/MacApp question: Each() Message-ID: <10597@goofy.Apple.COM> Date: 6 Oct 90 08:38:26 GMT References: <10615@pt.cs.cmu.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 32 In article <10615@pt.cs.cmu.edu> mkb@rover.ri.cmu.edu (Mike Blackwell) writes: >I have another question about using MacApp with C++, involving the Each >method. >I'm going through the 2.0 tutorial, but coding in C++. The C++ version of IconEdit is provided in the "Unsupported Goodies" folder of the MacApp 2.0 CD Release, also available on the ETO disk (yet another reason to get ETO!) The following code is taken from there: Longint NullStaticLink; // Use &NullStaticLink when a static link pascal void InvalidateView (TView* aView, void* InvalidateView_StaticLink) { aView->ForceRedraw(); // Cause the view to be redrawn. } pascal void TIconDocument::RedrawViews() { ForAllViewsDo(InvalidateView, &NullStaticLink); // Invalidate each of the doc's views. } Of course, in other cases involving static links, such as when you provide a Compare function for a call to a subclass of TSortedList->Search(), you can actually pass something useful instead of NullStaticLink. I should also refer you to the excellent discussion of converting nested procedures to C++ by Keith Rollin in tech note #265. Hope this helps. - Mark