On Dec 29, 2009, at 4:09 PM, Edwards, Waverly wrote: > > I have the standard window handler checked in the nib window > attributes. Should be no problem > > 1. Is the standard event handler supposed to hide the sheet? No. Basic process is: (1) Build the parent window ( i.e. load it from the nib and probably do a ShowWindow() ) (2) Build the sheet window but don't do a fn ShowWindow (3) When user requests the sheet window do a fn ShowSheetWIndow passing the WindowRefs of the parent window and sheet window. (4) When the user dismisses the sheet window ( e.g. OK button, cancel button ) do a HideSheetWindow( sheetWindowRef ). (5) If my sheet is only used on this parent window, I dispose of the sheet window when the parent is closed ( DisposeWindow ( w ) ). > 2. Anyone know if you are suppose to dispose of the user data that > you create or is it done when you remove the event handler. It's called user data because the programmer decides when ( if ever ) it is disposed. That parm only makes a pointer to your data available in the handler. It does not automatically ( nor should it ) dispose of any data. Of course, the programmer can elect to dispose of the data wherever/whenever it makes sense. > > When I "free" my data, upon the third time I've shown and removed > the sheet, the program crashes. Not enough information. Please post the thread of the crashreporter log ( unless that tidbit you posted reproduces it ? didn't try it ) OK, I just looked at your posted code. You know, of course, that passing WindowRefs in userdata is not necessary to make sheet windows work, right? Maybe give the list an overview of what you're trying to accomplish > I dont want to have a data leak and I dont know how to determine > whether the data was already destroyed. Well, at some point you have to free that data. However, you may not need an allocated pointer. You could just pass the WindowRefs directly ( maybe a pointer to a record containing them ) and would bypass the need to free. Of course, this assumes you really need those WindowRefs. > > These are modified versions of RP's "Sheet Alerts (method 1)" from > 2005, if it matters. there is a more recent demo in the "Dialogs and Windows" folder for FB5. Brian S