Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!pepper!cmcmanis From: cmcmanis%pepper@Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga Subject: Re: Burning Questions Message-ID: <34827@sun.uucp> Date: Tue, 24-Nov-87 21:04:03 EST Article-I.D.: sun.34827 Posted: Tue Nov 24 21:04:03 1987 Date-Received: Sat, 28-Nov-87 06:58:07 EST References: <6570001@hpindda.HP.COM> Sender: news@sun.uucp Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Organization: Sun Microsystems, Mountain View Lines: 71 [Coming soon : The Compleate Intuition Example Program (TCIEP) ] In article <6570001@hpindda.HP.COM> (Grant Haidinyak) writes: >I seem to be having trouble with requesters... >I use the InitRequester, and setup the requester stucture as follows: > InitRequester(rqstr); > rqstr->LeftEdge = 160; > rqstr->TopEdge = 50; > rqstr->Width = log_rqstr_image.Width; > rqstr->Height = log_rqstr_image.Height; > rqstr->RelLeft = 0; > rqstr->RelTop = 0; > rqstr->ReqGadget = &log_rqstr_gadget; > rqstr->ReqBorder = NULL; > rqstr->ReqText = NULL; > rqstr->Flags = PREDRAWN; > rqstr->BackFill = 1; > rqstr->ImageBMap = log_rqstr_bitmap; > >and to render the requester I do the following: > Request(&log_rqstr, win_main); Didn't you mean "Request(rqstr,win_main);" here? The variable log_rqstr doesn't seem to be initialized by the above code. Also if you declare log_rqstr as a struct Requester then the above call will work but if you declare it as a struct Requester * then the & above causes the C compiler to pass a pointer to a pointer to a struct Requester. >What happens is that after the call to Request, nothing is displayed, >however, after I double click on the window, the requester is rendered, >and everything works fine from then on. >My Question is: What am I doing wrong? Well, this should work if you set it up correctly. When you say 'double click' are you referring to the select button or the Menu button of the mouse ? I ask because if the requester flags are set with DMREQUEST then it takes a double menu click to bring up the requester. >Also, I'm writing a program that has multiple windows being opened, that >are attached to one port. The problem that I have found with this is: > > 1) A Close request for a window comes in. > 2) I Close the window, the messages associated with this window > get deallocated. > 3) There are still pending messages for the window queued to the port. > 4) I start to process the queueed messages. > 5) Guru because of bad next link pointer (memory had been deallocated). The magic is that you open your initial window, then subsequent windows you open with NULL IDCMP Flags, and copy the message port pointer from the initial window into the new windows structure. Then use ModifyICMP() to set the events you want to see. Before closing the window you do the same thing in reverse. ModifyIDCMP() back to nothing, set the message port pointer to NULL, and then close the window. Let the parent window dispose of any extra messages. > There are good points, and bad points associated with each method, but > I'd like to know which is accepted, or if there is a standard way of > doing this already. The above is the 'accepted' way of doing that. It's based on an example that Jim Mackraz did which included a routine CloseWindowSafely() that took care of the message port stuff. This is another case of 'Those Fish Disks sure are valuable!' There are examples of ways to do this on some of the early disks. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't youme