home *** CD-ROM | disk | FTP | other *** search
- #include <Quickdraw.h>
- #include <WindowMgr.h>
- #include <EventMgr.h>
- #include <OSUtil.h>
- #include <ToolboxUtil.h>
- #include <ControlMgr.h>
-
- /* teeny sheel to test a control
- * Steve Hawley 8/88
- * Portions are copyright Think Technologies
- */
-
- #define RSRC_ID 294 /* resource ID as defined in the project */
-
- WindowRecord wRecord;
- WindowPtr myWindow;
- EventRecord myEvent;
-
- main ()
- {
- Rect screen, r;
- ControlHandle myctrl, thectrl;
-
- InitGraf(&thePort); /* do inits */
- InitWindows();
- FlushEvents(everyEvent,0);
- SetCursor(&arrow);
- ShowCursor();
- SetRect(&screen, 4, 40, 508, 340); /*set up window */
- myWindow = NewWindow(&wRecord, &screen, "\Pstuff",
- 1,0,(char*)-1,1,(long)0);
- SetPort(myWindow);
- ShowWindow(myWindow);
- SetOrigin(0,0);
- TextSize(9);
-
- SetRect(&r, 10, 10, 90, 90);
-
- /* The visible is TRUE ( (char)1 ), initial setting is off (0),
- * range is 0-1, and there is no action procedure.
- */
- myctrl = NewControl(myWindow, &r, "\PA Button", (char)1, 0, 0, 1,
- 16 * RSRC_ID, 0L);
-
- while(1) {
- if (GetNextEvent(everyEvent, &myEvent)) {
- /* exit on keypress */
- if (myEvent.what == keyDown) ExitToShell();
- if (myEvent.what == mouseDown) {
- GlobalToLocal(&myEvent.where);
- if (FindControl(myEvent.where, myWindow, &thectrl))
- TrackControl(thectrl, myEvent.where, 0L);
- }
- }
- }
- }
-