cancel
Showing results for 
Search instead for 
Did you mean: 

Pop up should appear in centre of screen.

Former Member
0 Kudos

Hi,

I am displaying many pop-ups with varying size in my web dynpro screens. I want these pop-ups to appear in the centre of the screen. How to achieve this?

Please help me.

thanks a lot.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi ,

try using the following codeto display popup in the centre ::


..
* Popup
   *  Generate Popup
    DATA lo_window_manager TYPE REF TO if_wd_window_manager.
    DATA lo_api_component  TYPE REF TO if_wd_component.
    DATA lo_window         TYPE REF TO if_wd_window.

    lo_api_component  = wd_comp_controller->wd_get_api( ).
    lo_window_manager = lo_api_component->get_window_manager( ).
    lo_window         = lo_window_manager->create_window(
      window_name          = 'W_POPUP'
     window_position = if_wd_window=>co_center 
      message_display_mode = if_wd_window=>co_msg_display_mode_selected
      button_kind          = if_wd_window=>co_buttons_yesno
      message_type         = if_wd_window=>co_msg_type_none
      default_button       = if_wd_window=>co_button_yes
      ).
    DATA:  l_api TYPE REF TO if_wd_view_controller.

    l_api = wd_this->wd_get_api( ).
    " subscribe action for Ok button
    lo_window->subscribe_to_button_event(
                 button            = if_wd_window=>co_button_yes
                 action_name       = 'OK_POPUP'
                 action_view       = l_api
                 is_default_button = abap_true ).

    lo_window->open( ).

here for the popup , u need to create one window , say

W_POPUP as in my code above and in that u need to embed that view , which shud appear as popup

for embedding the view double click on the window W_POPUP and now under the windows tab u cn right click n select embed view ( this is ur pop up view)

regds,

amit

former_member40425
Contributor
0 Kudos

While creating pop window set the position.

l_popup = l_window_manager->create_popup_to_confirm(
text = l_text
button_kind = if_wd_window=>co_buttons_yesno
message_type = if_wd_window=>co_msg_type_question
window_title = 'Test: Popup to confirm'
window_position = if_wd_window=>co_center ). " Use window_position as co_center
 
l_api = wd_this->wd_get_api( ).

I hope it helps.

Regards,

Rohit