DELETE WIDGET statement

Deletes one or more dynamic widgets.

Syntax

DELETE WIDGET handle[handle]...
handle
The handle of a dynamic widget.

Example

In the following example, the DELETE WIDGET statements deletes the dynamic button that you select:

r-delwid.p

DEFINE VARIABLE wh-tmp AS HANDLE  NO-UNDO.
DEFINE VARIABLE ix     AS INTEGER NO-UNDO.

DEFINE BUTTON b_quit LABEL "Quit" AUTO-ENDKEY.
DEFINE BUTTON b_make LABEL "Make Buttons".

DEFINE FRAME butt-frame b_make b_quit
  WITH CENTERED ROW 2.
DEFINE FRAME new-buttons 
  WITH WIDTH 48 CENTERED TITLE "New Buttons".

FRAME new-buttons:HEIGHT-CHARS = 3.

ON CHOOSE OF b_make IN FRAME butt-frame DO:
  DISABLE b_make WITH FRAME butt-frame.
  DO ix = 1 TO 10:
    CREATE BUTTON wh-tmp ASSIGN
      FRAME     = FRAME new-buttons:HANDLE
      COLUMN    = ix * 4
      LABEL     = STRING(ix)
      SENSITIVE = TRUE
      VISIBLE   = TRUE
      TRIGGERS:
        ON CHOOSE 
          PERSISTENT RUN del-self.
      END.
  END.
END.

ENABLE b_make b_quit WITH FRAME butt-frame.

WAIT-FOR CHOOSE OF b_quit IN FRAME butt-frame.

PROCEDURE del-self:
  IF SELF:PREV-SIBLING = ? AND SELF:NEXT-SIBLING = ? THEN DO:
    HIDE FRAME new-buttons.
    ENABLE b_make WITH FRAME butt-frame.
  END.
  MESSAGE "Deleting Widget, Button" SELF:LABEL.
  DELETE WIDGET SELF.
END PROCEDURE.

Notes

See also

CREATE widget statement