Path: news.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!newsrelay.iastate.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!pipex!uunet!haven.umd.edu!cville-srv.wam.umd.edu!iigs From: iigs@wam.umd.edu (The Doctor) Newsgroups: comp.sys.apple2.programmer Subject: How to handle an NDA Closing Date: 26 Oct 1993 22:38:46 GMT Organization: University of Maryland, College Park Lines: 241 Message-ID: <2ak8tm$e4b@cville-srv.wam.umd.edu> NNTP-Posting-Host: rac3.wam.umd.edu In my program (all relevent sections is posted below), I am changing the status of menus and menu items depending what windows are active and what window is the top window. Everything is working except with the closing of the NDA Window. If I use Close from the MenuBar of my program, it works fine. If I try to close an NDA with the NDA goawaybox or by pressing open-apple-W (i.e. Control Panel, but all NDAs I have active do the same thing), the Taskmaster loop doesn't recognize it. You can see in my task master loop that I check for wNDAClose both in the doNull as well as directly in the Taskmaster loop. When an NDA closes, I'm not getting the message that it closed. The program needs such information so the menus can be reactivated for the program use (this simulates sort of how AppleWorks GS handles NDAs). I appreciate any information in what I'm doing wrong. BTW, the code is in 65816, Orca-style. Main start TaskMaster loop using MBData EventLoop anop jsr changemenus wordresult pushword #$ffff event mask: we handle NDAopen pushlong #TaskRecord pointer to the task record _TaskMaster get the event pla get result asl a tax jsr (TaskTable,x) lda QuitFlag beq EventLoop done rts TaskTable anop GetNextEvents events dc i2'doNull' 0 = null dc i2'doRTS' 1 = mousedown dc i2'doRTS' 2 = mouseup dc i2'doObscure' 3 = keydown (Not listed here) dc i2'doRTS' 4 = undefined dc i2'doRTS' 5 = autokey dc i2'doRTS' 6 = update dc i2'doRTS' 7 = undefined dc i2'doRTS' 8 = activate dc i2'doMenuNeedChange' 9 = switch dc i2'doRTS' 10 = deskacc dc i2'doRTS' 11 = driver dc i2'doRTS' 12 = app1 dc i2'doRTS' 13 = app2 dc i2'doRTS' 14 = app3 dc i2'doRTS' 15 = app4 ; TaskMaster events dc i2'doRTS' 16 = wInDesktop dc i2'doMenu' 17 = wInMenuBar (Not listed here) dc i2'doRTS' 18 = wClickCalled dc i2'doRTS' 19 = wInContent dc i2'doRTS' 20 = wInDrag dc i2'doRTS' 21 = wInGrow dc i2'doClose' 22 = wInGoaway (Not listed here) dc i2'doRTS' 23 = wInZoom dc i2'doRTS' 24 = wInInfo dc i2'doMenu' 25 = wInSpecial (Not listed here) dc i2'doOpenNDA' 26 = wInDeskItem dc i2'doRTS' 27 = wInframe dc i2'doRTS' 28 = wInactMenu dc i2'doMenuNeedChange' 29 = wClosedNDA dc i2'doRTS' 30 = wCalledSysEdit dc i2'doRTS' 31 = wTrackZoom dc i2'doRTS' 32 = wHitFrame dc i2'doRTS' 33 = wInControl dc i2'doRTS' 34 = wInControlMenu end doNull start Check to see if NDA was closed using MBData lda Taskdata cmp #$001d #$001d = 29 decimal beq doMenuNeedChange rts end doOpenNDA start using MBData wordresult pushword TaskData _OpenNDA pla pushword #FALSE unhilite Menu pushword TaskData+2 _HiliteMenu doMenuNeedChange entry handle any menu need changing. lda #$8000 ora WindFlag sta WindFlag rts end ChangeMenus start ; enable or disable menu titles and items when necessary using MBData lda WindFlag bmi WindowChanged rts Windowchanged anop and #%0111111111111111 remove high bit sta WindFlag PushLong #0 _FrontWindow PullLong FrontWinPtr pushword #250 pushword #251 pushword #252 pushword #253 pushword #254 pushword #255 pushword #260 pushword #261 pushword #262 pushword #263 wordresult PushLong FrontWinPtr _GetWKind pla pl = app, mi= system bpl notNDA NDA _DisableMItem _DisableMItem _DisableMItem _DisableMItem _EnableMItem _EnableMItem _EnableMItem _EnableMItem _EnableMItem _EnableMItem PushWord #$ff7f flags: enable menu pushWord #3 _SetMenuFlag enable edit menu PushWord #$80 flags: disable menu pushWord #4 _SetMenuFlag dim go menu and items PushWord #$80 flags: disable menu pushWord #5 _SetMenuFlag dim view menu and items jmp setmenuitems2 notNDA anop PushWord #$ff7f flags: enable menu pushWord #4 _SetMenuFlag enable go menu PushWord #$ff7f flags: enable menu pushWord #5 _SetMenuFlag enable view menu lda #%0011111111111111 bit WindFlag beq NotAScreen Screen _EnableMItem _EnableMItem _DisableMItem _DisableMItem _EnableMItem _DisableMItem _DisableMItem _DisableMItem _DisableMItem _DisableMItem PushWord #$80 flags: disable menu pushWord #3 _SetMenuFlag dim edit menu and items bra GotoSMI NotAScreen anop either no windows or document window bvc NoWind _EnableMItem _EnableMItem _EnableMItem _EnableMItem _EnableMItem _EnableMItem _EnableMItem _EnableMItem _EnableMItem _EnableMItem PushWord #$ff7f flags: enable menu pushWord #3 _SetMenuFlag enable edit menu gotoSMI bra SetMenuItems NoWind anop _DisableMItem _DisableMItem _DisableMItem _DisableMItem _DisableMItem _DisableMItem _DisableMItem _DisableMItem _DisableMItem _DisableMItem PushWord #$80 flags: disable menu pushWord #3 _SetMenuFlag dim edit menu and items SetMenuItems anop pushword #264 pushword #265 pushword #266 pushword #267 bit WindFlag bvc NoWind2 _EnableMItem _DisableMItem _DisableMItem _EnableMItem bra SetMenuItems2 NoWind2 _DisableMItem _DisableMItem _DisableMItem _DisableMItem SetMenuItems2 anop pushword #258 pushword #259 bit WindFlag bvs WindList _EnableMItem _EnableMItem bra Done WindList _DisableMItem _DisableMItem Done _DrawMenuBar rts end MBData data QuitFlag ds 2 nonzero = quit from waitevent loop FrontWinPtr ds 4 ptr to front window in close item Windflag ds 2 open window = true, no window=false TaskRecord anop What ds 2 event code Message ds 4 event message When ds 4 tick count Where ds 4 mouse location Modifier ds 2 key modifier TaskData ds 4 return value TaskMask dc i4'$1fffef' TaskMaster mask: (allow all but OpenNDA) LastClkTick ds 4 Tick value of last click ClickCount ds 2 type of last click TaskData2 ds 4 additional Data TaskData3 ds 4 additional Data TaskData4 ds 4 additional Data LastClickY ds 2 vertical axis of last click LastClickX ds 2 horizontal axis of last click end -- iigs@wam.umd.edu