BB___MODIFIED

=MODIFIED= toc

Description
> Returns a string either "true" or "false" indicating whether any data in the text window or texteditor has been changed by the user.

Hints
> (you can keep the text by sequence... code format="lb"   #h.text "!contents? save$"    #h.text "!cls"    #h.text "!contents save$" code but cursor position will be lost).
 * 1) //**Using Modified?**// This command is often used before closing a text window or texteditor in order to warn the user if the text has changed in any way. This can give the user an opportunity to save the data before closing the window. The procedure can be included just before the window is closed as an automatic safeguard against losing unsaved data.
 * 2) //**Programmed changes.**// Writing text programmatically does not change modified flag. The "!CLS" command resets modified flag to //false//. (Manually deleting all text does set flag to true).
 * 3) There is no way to reset modified flag to //false// while keeping cursor position

Example
code format="lb" nomainwin

WindowWidth=300 WindowHeight=300

statictext #h.st1 "Enter contact data", 10, 15, 200, 20 texteditor #h.text 10, 35, 260, 150 button #h.btn "Close", [mainExit], UL, 10, 200

open "" for window as #h #h "trapclose [quit]" '   'print some sample text to the texteditor window '   #h.text "This is the original contents of the data file. ";chr$(13);_ "Close window without changing text.";chr$(13);_ "Then change text and close window to see ";chr$(13);_ "the difference." wait

[mainExit] 'check if text has changed...   #h.text, "!modified? modify$"

If modify$ = "true" then Confirm "The contents have changed. Save before closing?"; answer$ If answer$ = "yes" then [save] End if

'program ends here if text is unchanged or if   'user decides not to save changes. close #h end

[save] confirm "Contents saved. Close now?"; yn$ if yn$= "yes" then [quit] wait

[quit] close #h end code

Useful Functions
code format="lb" Place a useful function using this keyword here code