cancel
Showing results for 
Search instead for 
Did you mean: 

Handle button event of popup created from component controller

Former Member
0 Kudos

Hi all,

I have created a method for created popup in the component controller with button kind 'yes-no'.Now i use it in the view.

Till here all is working fine.

Now i want to use the events which triggers on the popup (yes, no).Any idea how to trigger these buttons action.

The problem i am facing here is: When i use <b>subscribe_to_button_event</b> method it does not working.

Any ideas how to use this.

Points will be sured.

Sanket sethi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi alex b justin,

Actually i am created popup window from component controller and adding buutons and their events in view for multiusing of a popup.

Now i am not able to link the component controller to view:

CALL METHOD if_wd_window->subscribe_to_button_event

EXPORTING

button = if_wd_window=>co_button_yes

button_text = 'Confirm Yes'

action_name = 'YES'

<b>action_view = l_api</b>

is_default_button = abap_true.

help me out.

Former Member
0 Kudos

hi sanket...

be little clearer in your explanation......

you mean to say that you have the method for the calling the pop up in the component controller and you want to call it from a view. right?

--regards,

alex b justin

Former Member
0 Kudos

Hi alex b justin,

Right.and i created only the popup there with button kind 'YesNo'.

and in view i want to use the buttons event.

I created it in a method and call that method in view.

Now the query is how to describe buttons in view for the popup which created in component controller?

Sanket

Former Member
0 Kudos

hi sanket...

just pass ypour view id to the component controller method.

consider you are having a method m1 in component controller.

this m1 has the codings to call the pop up.

in the view v1 when a button is clicked, this method would be called.

in the import parameters of the method m1 create a parameter to get the view id of type if_wd_view.

so when you call this method from v1 pass this view id and this view id must be given in the subscribe_to_button_event.

--regards,

alex b justin

Answers (1)

Answers (1)

Former Member
0 Kudos

hi sanket.........

here is a code snippet... check this out.

 data: l_cmp_api          type ref to if_wd_component,

        l_window_manager   type ref to if_wd_window_manager,

        l_popup            type ref to if_wd_window,

        l_text             type string_table,

        l_api              type ref to if_wd_view_controller.

 

 

  l_cmp_api        = wd_comp_controller->wd_get_api( ).

  l_window_manager = l_cmp_api->get_window_manager( ).

  insert `Data where changed` into table l_text.    

  insert `Do you want to save?`        into table l_text.    

 

  l_popup = l_window_manager->create_popup_to_confirm(

                text            = l_text

                button_kind     = if_wd_window=>co_buttons_yesnocancel

                message_type    = if_wd_window=>co_msg_type_question

                window_title    = 'Test: Popup to confirm'

                window_position = if_wd_window=>co_center ).

 

  l_api = wd_this->wd_get_api( ).

 

  l_popup->subscribe_to_button_event(

               button            = if_wd_window=>co_button_yes

               action_name       = 'YES'

               action_view       = l_api

               is_default_button = abap_true ).

  l_popup->subscribe_to_button_event(

               button            = if_wd_window=>co_button_no

               action_name       = 'NO'

               action_view       = l_api

               is_default_button = abap_false ).

  l_popup->subscribe_to_button_event(

               button            = if_wd_window=>co_button_cancel

               action_name       = 'CANCEL'

               action_view       = l_api

               is_default_button = abap_false ).

 

  l_popup->open( ).

--regards,

alex b justin