开发者

Blackberry - Disable Save option in BasicEditField?

开发者 https://www.devze.com 2022-12-23 18:33 出处:网络
I am using a basiceditfield to take input from the user to do some simple string search. But if i type a few letters and wish to go back without continuing the search, it automatically asks me whether

I am using a basiceditfield to take input from the user to do some simple string search. But if i type a few letters and wish to go back without continuing the search, it automatically asks me whether to save the contents of the field. I don want this to happen. Can i in any way disa开发者_运维问答ble the "Changes made!-save-discard-cancel" option in basiceditfield(or any editfield for that matter)????please help!!!


Try adding this to your MainScreen class:

protected boolean onSavePrompt() {
        return true;
    }


Another way would be to override the dirty state logic on your Screen class like this:

public boolean isDirty() { return false; }

Of course you can also just override that same method on a subclass of your Field, and that too should probably work. (assuming you still want to do dirty-state-tracking of other fields on the screen.)


modify onClose method of Screen

 public boolean onClose() {
   this.close();
   return true;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消