Community
Showing results for 
Search instead for 
Do you mean 
Reply

CurrentContact.HasChanges not correct

New Member
Posts: 4
Country: Australia

CurrentContact.HasChanges not correct

My plugin uses the 'ShowContact' method of UIContactManager

 

If you call this when there are pending changes to the currently displayed record, those changes are lost

 

To prevent this, I have been using actapp.ApplicationState.CurrentContact and checking the HasChanges member

 

I dont understand why but this is unreliable - if I make a change in a field and then click away to another field it is OK, but if I make a change and havent yet clicked away the 'HasChanges' is false.

 

Is there any sure-fire way of either getting an accurate 'HasChanges', either that or something I can do before 'ShowContact' that saves the pending changes - if you click on 'next contact' in the GUI it automatically saves the change.

 

This is in Act! 10 that I am experiencing this specifically - I dont have a previous version to compare against at this time.

Tuned Listener
Posts: 20
Country: USA

Re: CurrentContact.HasChanges not correct

Mark,

 

What's probably happening is that HasChanges property is not modified until the control where the changes has made has lost focus.  I think that's consistent behavior for forms not just in ACT!, but through out the dotNet world when it comes to Databound Forms.  It's likely you will not be able to see changes in the HasChanges, without change the focus of the controls in the UI.  

 

Anybody know this for certain?

 

Also as an alternative you could keep the current record's data cached when you first enter the record, and then check each control for data changes before you call ShowContact.

--
Jason L. van Brackel
Nickel Super Contributor
Posts: 441
Country: UK

Re: CurrentContact.HasChanges not correct

Mark its probably easiest just to call Actapp.ApplicationState.CurrentContact.Update - this will save the contact before you display the next one.  The overhead on saving one contact isn't much so its easier to do this rather that check for changes.

 

Tom

Tuned Listener
Posts: 20
Country: USA

Re: CurrentContact.HasChanges not correct

Tom's definately right assuming you always want to save those changes.

--
Jason L. van Brackel
New Member
Posts: 4
Country: Australia

Re: CurrentContact.HasChanges not correct

Thanks guys for the suggestions, but unfortunately the Update() doesnt help - which makes sense I suppose - if Act! doesnt think the form is 'dirty' then it won't save it either

 

This is linked to my computer telephony application - I have a plugin in Act! that links to my CTI app for screen pops etc - for now I think I am going to have to make the screen pop manually selected rather than automatic - or at least make it optional - from what I can tell this isnt likely to be something that will go away

 

Regards

 

Mark

Tuned Listener
Posts: 20
Country: USA

Re: CurrentContact.HasChanges not correct

Mark,

 

Can you not just move to another field then call the Update() method?

--
Jason L. van Brackel
New Member
Posts: 4
Country: Australia

Re: CurrentContact.HasChanges not correct

Hi Jason,

 

that sounds like a good plan - how do I programmatically move to the next field.

 

I tried a few days ago just using SendKeys with a \t, and also with a ^s just in case

 

Mark

Tuned Listener
Posts: 20
Country: USA

Re: CurrentContact.HasChanges not correct

Mark,

 

I've not actually attempted to do that with .NET, or the ACT! SDK.  If you can't get SendKeys to work, you could either attept to set focus on another control on the form, or add a space and remove it in the data for another field that you're not currently editing.  This should trigger the change in the HasChanges property.

 

Jason

--
Jason L. van Brackel
Tuned Listener
Posts: 20
Country: USA

Re: CurrentContact.HasChanges not correct

Mark,

 

I'm curious if you've found a positive resolution.  Any luck?

 

--
Jason L. van Brackel
New Member
Posts: 4
Country: Australia

Re: CurrentContact.HasChanges not correct

Havent got around to it as yet - but I am sceptical - I suspect that even though this will set the 'HasChanges' I doubt it will set the field I am editing in the GUI as changed

 

It would of course be neat if Act! warned you or just saved the changes - after all it knows when you click on 'next record' that it needs to save the changes - I will let you know once I have had an opportunity to try it anyway