IonicWind Software

IWBasic => General Questions => Topic started by: Jerry Muelver on February 10, 2008, 11:17:59 AM

Title: RTGETMODIFIED always -1
Post by: Jerry Muelver on February 10, 2008, 11:17:59 AM
Add this code to Case 6:'Save in the RichEdit demo file (DEF ret AS INT first, of course), and you'll see that GETMODIFIED always returns -1, no matter if the file is changed, even if you set it 0 when the file is loaded.


CASE 6:'SAVE
ret = CONTROLCMD (d1,1,@RTGETMODIFIED)
ret = MESSAGEBOX(d1,"modified = " + str$(ret),"Modified?")
filename = FILEREQUEST("Save file",d1,0,filter,"rtf")
Title: Re: RTGETMODIFIED always -1
Post by: Ionic Wind Support Team on February 10, 2008, 11:44:32 AM
Jerry,
The modified state of a RE control is not automatic and must be set with the @RTSETMODIFIED control command.  It is just a conveniece 'state' variable provided by the control.

If you were designing a code editor for example you could set/get the modified state on each keystroke.  Turning it off if the current code in the control matches the saved code.

Paul.
Title: Re: RTGETMODIFIED always -1
Post by: Ionic Wind Support Team on February 10, 2008, 11:49:09 AM
More information...according to Microsoft the modified state is initially 0 when the control is created.  Any operation on the control, such as entering text, setting a font, color, margin, etc with set the modified status to -1

After it is set to -1 it is never cleared by the contol unless you do it manually.

Paul.
Title: Re: RTGETMODIFIED always -1
Post by: Jerry Muelver on February 10, 2008, 12:11:20 PM
Thanks, Paul. I thought I was clearing it, but might not have been as scrupulous as necessary. Alyce sent me some code to make RTGETMODIFIED work in your RichEdit demo program. Let's see if I can transport that to my labyrinthian project code. Shucks, if writing a wiki in a RichEdit control was easy, it would have been done a long time ago!  ::)