jdm@ut-ngp.UUCP (Jim Meiss) (11/19/86)
I am a novitiate both to C and to MacIntosh programing, so please pardon the question if it turns out to be trivial. I would like to implement the zoom box on a window using Lightspeed C v. 1.02 on a MacPlus. According to Tech Note #57 (the only thing I have seen written on the subject) one defines a window of type 8. This indeed gives the zoombox in the window. Next I used the enclosed code fragment to try to get the zoom. My window that zooms out okay, but will not zoom in. How come??? Perhaps my problem is in the definition of the functions TrackBox and ZoomWindow... Another question: Is it possible to set the size that the window zooms to? ------------------------------------- /* Code Fragment for Zoom Windows */ enum { inDesk, inMenuBar, inSysWindow, inContent, inDrag, inGrow, inGoAway, inZoomIn, inZoomOut }; . . pascal Boolean *TrackBox() = 0xA83B; pascal void *ZoomWindow() = 0xA83A; . . . main() { WindowPtr whichWindow; EventRecord myEvent; InitGraf(&thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); for(;;) /* forever */ { SystemTask(); if (GetNextEvent(everyEvent, &myEvent)) { switch(myEvent.what) { case mouseDown: switch (FindWindow( myEvent.where, &whichWindow )) { . . case inZoomIn: if(TrackBox(whichWindow,myEvent.where,inZoomIn)) ZoomWindow(whichWindow,inZoomIn,0); break; case inZoomOut: if(TrackBox(whichWindow,myEvent.where,inZoomOut)) ZoomWindow(whichWindow,inZoomOut,0); break; default: break; } /* end switch findwindow */ break; . . default: break; } /* end switch which event */ . . } /* end if event */ } /* end forever */ } /* end main */ -------------------------------------] Thanks for your help, Jim Meiss ut-npg!jdm
mrh@Shasta.STANFORD.EDU (Marc Hannah) (11/20/86)
In article <4319@ut-ngp.UUCP>, jdm@ut-ngp.UUCP (Jim Meiss) writes: > > I am a novitiate both to C and to MacIntosh programing, so > please pardon the question if it turns out to be trivial. > > I would like to implement the zoom box on a window using > Lightspeed C v. 1.02 on a MacPlus. According to Tech Note #57 (the only > thing I have seen written on the subject) one defines a window of type 8. This indeed gives the zoombox in the window. Next I used the enclosed code fragment to try to get the zoom. > My window that zooms out okay, but will not zoom in. How come??? Perhaps my problem is in the definition of the functions TrackBox > and ZoomWindow... > > Another question: Is it possible to set the size that > the window zooms to? > Apple Technical note number #79 gives is a short but useful note about doing zooming. In particular it gives some sample code on how to handle zooming. It also indicates that the DataHandle part of the window record contants a pointer to a structure that consists of two rectanges (not pointers to rectangles). The first rectangle is the unzoomed state and the second is the zoomed state. The note is careful to mention that you should make sure DataHandle is not NIL since that would be the case on a non-zoomable window (i.e. the user is using the old ROM). David Gelphman BITNET address: DAVEG@SLACVM Bin #88 SLAC ARPANET address: DAVEG@SLACVM.BITNET Stanford, Calif. 94305 UUCP address: ...psuvax1!daveg%slacvm.bitnet 415-854-3300 x2538 usual disclaimer #432 applies: my employer apologies for the fact that I have access to this net.