Newsgroups: comp.sys.apple2.programmer Path: news.uiowa.edu!news.physics.uiowa.edu!math.ohio-state.edu!howland.reston.ans.net!ixnews1.ix.netcom.com!netcom.com!lstrand From: lstrand@netcom.com (Leif Strand) Subject: Re: Scroll bars in NDAs Message-ID: Organization: NETCOM On-line Communication Services (408 261-4700 guest) References: <1996Apr23.135550.28027@unislc.slc.unisys.com> <1996Apr30.132612.11047@unislc.slc.unisys.com> Date: Tue, 30 Apr 1996 19:04:28 GMT Lines: 95 Sender: lstrand@netcom23.netcom.com (*** Here is the NDA with which I experimented. Compiled with TML Pascal II. ***) {$NDA -1 -1 ScrollBarDA } unit ScrollBarDA; interface uses Types, Memory, MiscTool, QuickDraw, Events, Desk, Controls, Windows, Menus; function DAOpen: WindowPtr; procedure DAClose; procedure DAAction(code: Integer; param: EventRecordPtr); procedure DAInit(code: Integer); implementation var windPtr: WindowPtr; pList: ParamList; title: Str32; {$DefProc} procedure ContDefProc; begin MoveTo(7,10); DrawString('Hello, world.') end; function DAOpen: WindowPtr; begin title := 'ScrollBarNDA'; with pList do begin paramLength := sizeof(ParamList); wFrameBits := $DCA0; wTitle := @title; wRefCon := 0; SetRect(wZoom,0,0,0,0); wColor := nil; wYOrigin := 0; wXOrigin := 0; wDataH := 200; wDataW := 640; wMaxH := 0; wMaxW := 0; wScrollVer := 5; wScrollHor := 12; wPageVer := 0; wPageHor := 0; wInfoRefCon := 0; wInfoHeight := 0; wFrameDefProc := nil; wInfoDefProc := nil; wContDefProc := @ContDefProc; SetRect(wPosition,50,70,250,170); wPlane := WindowPtr(topMost); wStorage := nil end; windPtr := NewWindow(pList); SetSysWindow(windPtr); DAOpen := windPtr end; procedure DAClose; begin if windPtr <> nil then begin CloseWindow(windPtr); windPtr := nil end end; procedure DAAction(code: Integer; param: EventRecordPtr); var taskRec: WMTaskRec; taskCode: Integer; begin if code = eventAction then begin with taskRec do begin (*** Copy the event record into our own task record. See Apple IIgs Technote #84. ***) wmWhat := param^.what; wmMessage := param^.message; wmWhen := param^.when; wmWhere := param^.where; wmModifiers := param^.modifiers; (*** Set the task mask for scrolling and updates. ***) wmTaskMask := tmScroll + tmUpdate + tmFindW end; (*** If you use TaskMasterDA for anything else (e.g., to track content controls), be sure to also zero the extended portions of the task record before the NDA starts. ***) taskCode := TaskMasterDA(0,@taskRec) end end; procedure DAInit(code: Integer); begin if code <> 0 then windPtr := nil end; end. (*** --Leif ***)