Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!sdd.hp.com!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!strath-cs!expya!exua!kt From: kt@msor.msor (Keith Tizzard) Newsgroups: comp.sys.mac.programmer Subject: C++ programming under MPW - advice sought Message-ID: <1082@exua.exeter.ac.uk> Date: 7 Dec 90 17:17:56 GMT Sender: news@exua.exeter.ac.uk Organization: MSOR Department, Exeter University, UK Lines: 100 Nntp-Posting-Host: Originator: kt@msor0 I am trying to use C++ under MPW and would welcome some advice and help. The C++ language creates no problem since I have used it in other environments. The problem comes when I try to find out about the MacApp classes and their methods. Where do I look for a clear description? Do I need to acquire and read all the volumes of Inside Macintosh? Is there a class browser to enable me to find out, quickly and easily what classes are available to inherit and what member functions they contain? Basically I am comfortable with obejct orientated programming and C++ but am new to programming the Mac. Any advice about how to proceed would be most welcome. In the APDAlog I note the publications: C++ Programming with MacApp by David Wilson, Larry Rosenstein and Dan Shafer Elements of C++ Macintosh Programming by Dan Weston Has anybody read and used these? Are they helpful for the novice? Let me illustrate my difficulty. The following code is taken from ShapesApp.cp, one of the files in the distributed C++ examples which come with MPW. Reading the code is difficult and the thought of creating new code is awe inspiring. Within the class constructors and member functions very little appears to be object orientated. In the constructor TShapesApp, shown below, are SetMenuBar(), DisposHandle(), DrawMenuBar() ... external functions (i.e. C) or are they inherited member functions? Why does it not say: menuBar->Set() or maybe menuBar.Set() and menuBar->DisposeHandle the code does not appear to be very object orientated. Where do I look, on the system, to find out where these functions are? Do I Search the 17 include files at the top of TApplication.cp ?? TShapesApp::TShapesApp(void) { Handle menuBar; menuBar = GetNewMBar(rMenuBar); SetMenuBar(menuBar); DisposHandle(menuBar); AddResMenu(GetMHandle(mApple), 'DRVR'); DrawMenuBar(); fMouseRgn = NewRgn(); DoNew(); } In the following member function why do we have: ? EnableItem(menu, iNew); instead of menu->EnableItem(iNew) DisableItem(menu, iClose); instead of menu->DisableItem(iClose); menu = GetMHandle(mFile); instead of menu = mFile->GetMHandle(); void TShapesApp::AdjustMenus(void) { WindowPtr frontmost; MenuHandle menu; TShapesDocument* fShapesCurDoc = (TShapesDocument*) fCurDoc; frontmost = FrontWindow(); menu = GetMHandle(mFile); if ( fDocList->NumDocs() < kMaxOpenDocuments ) EnableItem(menu, iNew); else DisableItem(menu, iNew); if ( frontmost != (WindowPtr) nil ) EnableItem(menu, iClose); else DisableItem(menu, iClose); // stuff deleted } When using a set of existing classes, easily accessible documentation is needed. By that I mean, a list of all the classes together with their member functions plus a clear description of what each one does. How can one program effectively in an OO language without a class browser? Is there one available?? -- Keith Tizzard MSOR Dept, University of Exeter, Streatham Court, EXETER EX4 4PU, UK tel: (+44) 392 264463 email: kt@msor.exeter.ac.uk kt@msor.UUCP