Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
shreedevi_shete
Posts: 48
Registered: ‎07-10-2010

Disable the prompt for save, discard and cancel.

Hi i have a screen which has an edit field.

Now  i make changes on this edit field.... and do my further processing.

Now i want to go back to my previous screen, so i press the back button,  then it gives me a prompt as SAVE, DISCARD,CANCEL.

I dont want this prompt to come.

How can i disable it.

Please use plain text.
Developer
simon_hain
Posts: 13,830
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: Disable the prompt for save, discard and cancel.

overwrite onsaveprompt to return false

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Trusted Contributor
swapnil_gadkari
Posts: 200
Registered: ‎02-22-2010
My Carrier: Airtel

Re: Disable the prompt for save, discard and cancel.

Please use plain text.
Developer
TobiasReaper
Posts: 85
Registered: ‎05-03-2010

Re: Disable the prompt for save, discard and cancel.

If you want to go back using the back button you may want to overwrite the keyChar method and in it check if(ch == Characters.ESCAPE) and pop your current screen. This will work without disabling the prompt.

Please use plain text.
Contributor
dfcontra
Posts: 16
Registered: ‎01-25-2011
My Carrier: Bell/T-Mobile

Re: Disable the prompt for save, discard and cancel.

I found that this the flowchart on Victor Ewerts blog that explains screen saving flow very succinctly. I think overwriting isDirty is the simplest way to disable the prompt, it also retains the use of the escape button, which overwriting onSavePrompt does not.

 

 

public boolean isDirty() {
	return false;
}

 

 

Please use plain text.
Contributor
jinchang
Posts: 44
Registered: ‎06-07-2010
My Carrier: Verizon

Re: Disable the prompt for save, discard and cancel.

Another quick-and-dirty method is to use setDirty(false), but I do agree that overriding isDirty() is probably the more standard approach.

Please use plain text.
New Contributor
chelo_c
Posts: 4
Registered: ‎03-05-2012
My Carrier: Claro

Re: Disable the prompt for save, discard and cancel.

Worked for me, thanks!
Please use plain text.