# Interface PopGuard

public interface PopGuard

Intercept back/pop attempts on a `Form`. Install with `Form#setPopGuard(PopGuard)`.

Typical use is to confirm before leaving a half-filled form, or to override hardware back to show a custom dialog.

##### Example

    editForm.setPopGuard(new PopGuard() {
        public boolean canPop(Form form, PopReason reason) {
            if (!isDirty()) return true;
            Dialog.show("Discard changes?", "You have unsaved edits.", "Stay", "Discard");
            return false; // block the pop; we'll dismiss explicitly if user picks Discard.
        }
    });

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `canPop(Form form, PopReason reason)`
  Decides whether a back/pop attempt should proceed.

- ## Method Details

  - ### canPop

    boolean canPop(Form form, PopReason reason)

    Decides whether a back/pop attempt should proceed.

    ###### Parameters

    - `form`: the form being popped.
    - `reason`: what triggered the pop (back button, programmatic, etc.).

    ###### Returns

    `true` to let the navigation proceed, `false` to block it. When blocking, the guard is responsible for any UI follow-up such as showing a confirm dialog and re-issuing the pop programmatically once confirmed.