KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Closing a 4D Write area without a save dialog
PRODUCT: 4D | VERSION: | PLATFORM:
Published On: July 16, 1999

If you create a 4D Write area and modify it, there seems to be no way to close it without the user seeing a "Save this file?" dialog. This applies whether you use close the document with WR Close Document or with the Close Window command.

A simple workaround is to define a dummy picture variable, and to use WR Save to Picture so the write area 'thinks' the document has been saved. If your Write area has a substantial amount of content, you might empty it before doing WR Save to Picture. A generic routine to force a Write area to close without a dialog might then be:

Cut and Paste the following code example into your
own 4D project

`Method CloseWriteArea
`by Guyren G Howe
`7/2/1999

`Parameters:
`$1: the reference area of the document to close

c_longint ($1; $dummyError) `Write area reference
c_picture ($dummyPicture)

`Empty the area
WR Do Command ($1; 208) `Select All
WR Do Command ($1; 206) `Clear

`Pretend to save the area
$dummy := WR Save to Picture ($1)

`Safe to close it now
$dummyError := WR Close Document ($1)