Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : DELETE WIDGET statement
 

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

*If you do not explicitly delete a dynamically created widget, it is deleted when its widget pool is deleted. If you do not create a new unnamed widget pool and do not explicitly specify a named widget pool when you create the widgets, all dynamic widgets are placed in the session pool. The session pool is not deleted until the ABL session that created it ends.
*If handle refers to a control-frame, any ActiveX control associated with the widget is also deleted. For more information on ActiveX support in ABL, see OpenEdge Development: Programming Interfaces.
*For SpeedScript, use with buffer-field, buffer-object, buffer, and query-object handles.

See also

CREATE widget statement