cancel
Showing results for 
Search instead for 
Did you mean: 

How can a dialog box close itself?

russell_day2
Participant
0 Kudos

I have a dialog box which displays a little form for some extra information. I have some non-standard buttons which are under my control. The form is created as a view in a window which is launched by CREATE_WINDOW.

I want the window to be able to close itself. The concept is easy - get a ref to the window, then call close( ).

But I cannot find a way to get a reference to the window from inside the window.

Here is my current solution which I do not like, but it works.

I create a context node 'POPUP' which has an attribute ME of type ref to if_wd_window.

When I create the window, I do this:

lo_window = lo_window_manager->create_window( ... )

lr_node = wd_context->get_child_node( 'POPUP' ).

lr_node->set_attribute( exporting name = 'ME'

value = lo_window ).

lo_window->open( ).

In the window, it gets ME out of the node, and does a lr_me->close( ).

But there is a better way, right? How does a dialog box close itself under program control?

I should add that the dialog box is displaying a view from a used component, so POPUP is defined in the used component and mapped into the context of the using component. I don't think this changes the problem, though.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Try this following code in method of button you have created for popup i.e method for example ok,cancel etc in the view which you have emebedded in ur window for popup.

  • Close the popup

DATA:

lo_api TYPE REF TO if_wd_view_controller,

lo_window_ctlr TYPE REF TO if_wd_window_controller,

lo_popup TYPE REF TO if_wd_window.

lo_api = wd_this->wd_get_api( ).

lo_window_ctlr = lo_api->get_embedding_window_ctlr( ).

lo_popup = lo_window_ctlr->get_window( ).

IF lo_popup IS BOUND.

lo_popup->close( ).

ENDIF.

Answers (0)