Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!rochester!udel!mmdf From: iphwk%MTSUNIX1.BITNET@cunyvm.cuny.edu (Bill Kinnersley) Newsgroups: comp.sys.amiga Subject: Re: Double Buffering and the Menu Strip Message-ID: <4213@louie.udel.EDU> Date: 24 Sep 88 23:13:37 GMT Sender: mmdf@udel.EDU Lines: 99 [In "Double Buffering and the Menu Strip", I said:] : : I'm attempting to write a program that needs to use both menus and : double buffered animation. That is, there will be well-defined periods of : menu selection interspersed with periods of double buffering. : The problem is that I keep losing the menu. To make that clearer; 1) The user makes a menu selection 2) He then "picks up" an image on the screen and moves it around. (This will be a double-buffered Bob) 3) He then "drops" the thing, and double buffering stops. 4) When next he tries to make a menu selection, the menu will not appear. : : Here is (schematically) how I open things: : : bm[0] = AllocMem(); : bm[1] = AllocMem(); : ns.Flags = CUSTOMSCREEN | CUSTOMBITMAP; : ns.CustomBitMap = bm[0]; : s = OpenScreen(&ns); : vp = &s->ViewPort; : nw.Screen = s; : w = OpenWindow(&nw); : rp = w->RPort; : SetMenuStrip(w,&menu[0]); : : and here is how I double buffer: : : vp->RasInfo->BitMap = bm[tog]; : WaitTOF(); : ScrollVPort(vp); : tog ^= 1; : rp->BitMap = bm[tog]; : The Screen structure comes equipped with its own instance of a BitMap. Normally both vp->RasInfo->BitMap and rp->BitMap point to s.BitMap. vp->RasInfo controls what you display, and rp->BitMap controls where you draw. We're supposed to be drawing to one BitMap while displaying the other. My first impression was that the menu was not being activated--that somehow Intuition was not picking up the MENUDOWN event, or not associating it with my window. This was wrong: the menu was being activated, it just wasn't being displayed. By blindly making the proper motions with the mouse I *could* select menu items, I just couldn't see anything happening. The menu was just not being rendered. OK, menus are handled outside of the Layer system. They're not rendered into a layer but directly into the screen's BitMap. Even though I'm using a window, Intuition is drawing the menus using the screen's own "naked" RastPort. Hah, that's the mistake, I should also be toggling that: s->BitMap = bm[tog]; Now the menus appear, sure enough they do. But without the menu STRIP! Well, I'm on the right track. How are the menu strips rendered? When you first open a screen, its LayerInfo structure comes with one layer 10 pixels tall for the menu strip. Pushing the menu button brings this layer to the front. This layer has a RastPort, and the RastPort has a BitMap, and, and...by golly I should toggle that too! s = OpenScreen(&ns); lrp = s->LayerInfo.top_layer->RastPort; ... ... lrp->BitMap = bm[tog]; Now it should work, right? Nope. The menu strip still does funny tricks. It appears and forgets to go away. Then the Window title appears with little sections hightlighted. You name it, it happens. It's cute! Don't get me wrong..it's BETTER. It *ALMOST* works. But somewhere in the bowels of the menu system, there must be a line of code that does not follow these BitMap pointers like it should. It ignores the pointers and does its rendering on s.BitMap directly. I think that's a bug. At any rate, my conclusion at this point is that I can think of nothing else to toggle, or nothing else I should HAVE to toggle. I think the only way that you can double buffer without losing much of the functionality of Intuition is to abandon this approach completely. I suggest letting the screen have its precious BitMap. Instead I will have to double buffer by using just one BitMap and redirecting the PlanePtrs in that BitMap. Am I wrong? Will doing it that way screw up my double-buffered Bob?? -- Bill Kinnersley Physics Department BITNET: iphwk@mtsunix1 Montana State University INTERNET: iphwk%mtsunix1.bitnet@cunyvm.cuny.edu Bozeman, MT 59717 CSNET: iphwk%mtsunix1.bitnet@relay.cs.net (406)994-3614 UUCP: ...ucbvax!mtsunix1.bitnet!iphwk "This message was packed as full as practicable by modern electronic equipment. Some settling of contents may have occurred during transmission."