setFocusLostSaveEnabled: how to use

Questions, tips and tricks and techniques for scripting in Servoy

setFocusLostSaveEnabled: how to use

Postby rioba » Tue Dec 13, 2005 7:29 pm

I want that changes made to a record are not saved automaticaly.

I tried setFocusLostSaveEnabled(false): no matter where I put it, it does nothing, ie the modified record is saved every time.

Any suggestion?
rioba
 
Posts: 242
Joined: Mon Aug 08, 2005 4:26 pm

Postby ebrandt » Tue Dec 13, 2005 9:02 pm

Maybe you could enable transacttions and either commit or rollback based on a event or variable
ebrandt
 
Posts: 590
Joined: Tue Mar 30, 2004 6:54 pm
Location: largo, fl

Postby rioba » Tue Dec 13, 2005 9:15 pm

Thank you for the suggestion. In fact, I thought doing it this way. However setFocusLostSaveEnabled(false/true) should do exactly this, if I am right. But it doesn't work. Or, I am unable of making it work.
rioba
 
Posts: 242
Joined: Mon Aug 08, 2005 4:26 pm

Postby ROCLASI » Wed Dec 14, 2005 12:58 am

Hi rioba,

You say the data is stored every time.
After you leave a field ? Or only after you browse to another record ?
I mean, when does this exactly happen?

Also what version of Servoy/Java do you use ?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby rioba » Wed Dec 14, 2005 7:19 am

Hi, Robert

this is exactly the question I asked myself a lot of times while trying to figure out how to use application.setFocusLostSaveEnabled. But I was unable to determine when the data were saved.

However, in my understanding (but this is probably the point) why would you need to automatically save (or not save) after losing focus if changes are saved in any case when you move from one record to another?

My problem is to force the user to confirm the modifications before moving to the next record. One could use a transaction (even if this seems to me to be an "overkill" option for such a simple operation), but in my case I am already inside a very large transaction, and therefore I am unable to start a new one.

I am using Servoy 2.2.3 on MacOS X and J2SE 5.0.

Thanks.
rioba
 
Posts: 242
Joined: Mon Aug 08, 2005 4:26 pm

Postby ROCLASI » Wed Dec 14, 2005 12:44 pm

What the setFocusLostSaveEnabled(false/true) does is when you click out of a field (and thus lose the focus of this GUI element) it lets/stops the auto-save-data do it's thing.
Now moving to another record is another matter. This has nothing to do with losing the focus of a GUI element.
I am sure Servoy WILL save the data then.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby rioba » Wed Dec 14, 2005 5:46 pm

Robert,

I am probably too dumb, but I still don't understand.

You are saying that setFocusLostSaveEnabled(false/true) works when leaving a GUI area (losing focus). This is ok. Let's say that I make a modification to a field, then I move to the next field. Obviously the modified field keeps the new value, unless I force a UI refresh.

When I move to the next record, the changes are saved. That's ok.

Now: in this case, what would have happened if I had used setFocusLostSaveEnabled(false)? I really don't understand.

Thanks.
rioba
 
Posts: 242
Joined: Mon Aug 08, 2005 4:26 pm

Postby ROCLASI » Wed Dec 14, 2005 7:04 pm

Hi rioba,

When you don't use setFocusLostSaveEnabled(false) then when you click outside a field or run any method then your data will be saved.
So if you want to prevent that from happening you use setFocusLostSaveEnabled(false).
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: setFocusLostSaveEnabled: how to use

Postby gabid » Mon Jul 26, 2010 5:10 pm

Is this function still available? If so, how does it work?

I'm trying to commit some changes when the user clicks or tabs away from a form field, but it seems that the data save is triggered only when the form is hidden.

I know that I can do that manually with "onFocusLost" methods, but I was wondering if there is a default behavior that might help me.

When the data from a form is saved?

Thanks,
Gabriel - Iulian Dumbrava
User avatar
gabid
 
Posts: 44
Joined: Fri Aug 15, 2008 10:25 am
Location: Craiova, Romania

Re: setFocusLostSaveEnabled: how to use

Postby jcompagner » Tue Jul 27, 2010 10:30 am

normally if you click besides a field (so on the form itselt,not in another field) the data will be saved
But if you just jump from field to field, it will not save until you switch to another record or form.

with databaseManager.setAutoSave() you can even switch that behavior off.

If you really want to save after focus lost of any field you have to program that yourself.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: setFocusLostSaveEnabled: how to use

Postby gabid » Tue Jul 27, 2010 1:22 pm

Thank you,

I wasn't able to figure out the autosave "rule".

Gabriel - Iulian Dumbrava
User avatar
gabid
 
Posts: 44
Joined: Fri Aug 15, 2008 10:25 am
Location: Craiova, Romania


Return to Methods

Who is online

Users browsing this forum: No registered users and 4 guests