Wednesday, March 7, 2012

Close Parent window while closing child window

Below pseudo code can be only used if child window is Standard Oracle form. If child window is custom then use close_window() or exit_form.

Pseudo logic
==========

Declare a parameter/global variable.
Initialize variable on PUSH_BUTTON  before opening child window.

When child window closes the cursor returns to the same item(PUSH_BUTTON) on main window.

Use below code in WHEN-NEW-ITEM-INSTANCE trigger of PUSH_BUTTON on main window to close parent window as soon as cursor returns back from child.


declare
  form_id FORMMODULE;
BEGIN
  IF :parameter.form_close = 'Y' THEN
    form_id := FIND_FORM(NAME_IN('SYSTEM.CURRENT_FORM'));
    IF NOT ID_NULL(form_id) THEN
      CLOSE_FORM(form_id);
    END IF;
  END IF;
END;


You can also use exit_form instead of close_form;

No comments:

Post a Comment