Just for reference I am adding an  (Form event=On After Edit) to my Write Pro 
object. This way any edit to the file will trigger a dirty event. Then I will 
probably need to reset the dirty flag upon saving. Otherwise I will wind up 
with hundreds of copies of the same document.

> On Nov 12, 2019, at 5:40 PM, Tom Benedict <[email protected]> wrote:
> 
> That’s correct. It’s not part of the Write Pro object. 
> 
> Initially I tried to add an attribute to the WP object, but wasn’t 
> successful. I’m a ‘baby programmer’ with objects so I don’t know whether its 
> possible to add attributes to a Write Pro object. My limited efforts failed.
> 
> Tom
> 
>> On Nov 12, 2019, at 14:29, Eric Naujock <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Reading in deeper. The WP_Information is a session variable object that 
>> keeps track of the WP Pro object is not the actual WP Pro object. Just 
>> asking to clarify.
>> 
>>> On Nov 12, 2019, at 5:20 PM, Tom Benedict <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> Hi Eric,
>>> 
>>> If I understand your question correctly, I think you’re looking for a 
>>> “dirty” flag. As far as I know there is no built in function that track 
>>> this, so you’ll need to create your own.
>>> 
>>> Below are the three methods I use to track the state of a Write Pro object. 
>>> It was inspired by help I received on forums.4d.fr <http://forums.4d.fr/>.
>>> 
>>> — Create an object in the On Load event of a Write Pro object call:
>>> 
>>>   // Method: WP_InitInformation
>>>   // ----------------------------------------------------
>>>   // User name (OS): Tom Benedict
>>>   // Date and time: 9/5/2019, 10:28:45
>>>   // ----------------------------------------------------
>>>   // Description
>>>   // bld277005
>>>   // 
>>> 
>>> C_OBJECT(WP_Information)
>>> 
>>> If (OB Is defined(WP_Information))  // already exists
>>>     WP_Information.IsNewDocument:=False
>>> Else 
>>>     WP_Information:=New object("IsNewDocument";False)
>>> End if 
>>> 
>>> If (OB Get type(WP_Information;"DocumentInfo")=Is undefined)  // doesn't 
>>> already exists
>>>     WP_Information.DocumentInfo:=New 
>>> object("FilePath";"";"Modification";False)
>>> Else 
>>>       // do nothing
>>> End if 
>>> 
>>> — Update the object whenever the Write Pro document is modified (like in 
>>> the On Data Change event of a Write Pro object):
>>> 
>>>   // Method: WP_Information_SetModified([isModified])
>>>   // ----------------------------------------------------
>>>   // User name (OS): Tom Benedict
>>>   // Date and time: 9/5/2019, 11:07:29
>>>   // ----------------------------------------------------
>>>   // Description
>>>   // Set the Modification Property of WP_Information object
>>>   // See WP_Information_Init
>>>   // bld277005
>>>   // 
>>> 
>>> C_BOOLEAN($1)
>>> 
>>> C_OBJECT(WP_Information)  // this object is initialized in 
>>> WP_Information_Init
>>> 
>>> If (Count parameters>0)
>>>     $isModified:=$1
>>> Else 
>>>     $isModified:=True  // default
>>> End if 
>>> 
>>> WP_Information.DocumentInfo.Modification:=$isModified
>>> 
>>> — Test the state wherever/whenever you wish with:
>>> 
>>>   // Method: WP_Information_isModified -> isModified
>>>   // ----------------------------------------------------
>>>   // User name (OS): Tom Benedict
>>>   // Date and time: 9/5/2019, 11:07:29
>>>   // ----------------------------------------------------
>>>   // Description
>>>   // Get the Modification Property of WP_Information object
>>>   // See WP_Information_Init
>>>   // bld277005
>>>   // 
>>> 
>>> C_OBJECT(WP_Information)
>>> C_BOOLEAN($0)
>>> 
>>> $0:=(WP_Information.DocumentInfo.Modification=True)
>>> 
>>> HTH,
>>> 
>>> Tom Benedict
>>> 
>>>> On Nov 12, 2019, at 14:07, Eric Naujock via 4D_Tech <[email protected] 
>>>> <mailto:[email protected]>> wrote:
>>>> 
>>>> I have a series of records and want to detect whether the 4D Write Pro 
>>>> object has been changed since it was loaded. This way I can keep a version 
>>>> archive of older versions of a document available. Is there an easy way 
>>>> I’m not seeing to know if the Write pro object has been changed since it 
>>>> was created or loaded. Right now I al creating a Write Pro object since 
>>>> 17R4 had an issues with saving rite Pro objects to a record in a 
>>>> client-server situation. Though I think it may have been fixed in R5 or 
>>>> R6. 
>>>> 
>>>> The Write pro object is created when the case is loaded as a free standing 
>>>> object since the object odes not reside in the main record table. Its 
>>>> lives in a large object table nearby since not all records have the Write 
>>>> Pro object in it.
>>>> 
>>>> Or is there a way to have an object change detecting in an event that 
>>>> would tell me there was a change in the object and that it needs to have 
>>>> the old object saved to the History table.
>>>> *****
>>> 
>> 
> 

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to