cancel
Showing results for 
Search instead for 
Did you mean: 

Changing button texts on internal pop-up window.

ChrisPaine
Active Contributor
0 Kudos

Hi -

I've not marked this a a question - as it is much more a rant, but if you have a suggestion, please do feel free to reply!

Why can I not change the text of buttons on an internal pop-up window?!

There is no API that I can find to update the text of the buttons.

The table in which the texts/buttons are stored is public in the class CL_WDR_INTERNAL_WINDOW, but marked as read only - so without enhancing the class I can't update the text.

I can understand the need to have consistency of appearance on applications - so having all popup windows with the same couple of buttons makes some sense ... and I can even understand the need to have some sort of restrictions to allow a unified rendering of the windows, but..even if I was still limited to have the same number of buttons as the standard constructor allows, then perhaps a method to allow me to change the text assigned to the button?

The alternative is that I choose the construct of no buttons and insert my own buttons in the view. But this looks ugly comparatively.

Why can't I make it look nice!

enought ranting - back to work

Chris

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Chris,

I am not sure, but I think we can change The text of button in popup by using method

SUBSCRIBE_TO_BUTTON_EVENT in interface IF_WD_WINDOW

Regards,

Raghava Channooru

ChrisPaine
Active Contributor
0 Kudos

HI Chris,

I am not sure, but I think we can change The text of button in popup by using method

SUBSCRIBE_TO_BUTTON_EVENT in interface IF_WD_WINDOW

Regards,

Raghava Channooru

And you are soooo right! argghhhh! I was pulling my hair (what little I have left) out over this...

Can't believe I missed that...

DOH!

Thanks - sorry it's not a question so I can't mark it as answered.

ChrisPaine
Active Contributor
0 Kudos

Ok....

what's more you can do this registering of buttons within an freely programmed value help....

Which is great - because now I can make all my pop-ups have the same look and feel!

Here's a little code snippet from within a value help that I programmed to allow selection of a Job....

method wddoinit .
  data: lo_view type ref to if_wd_view_controller,
       lo_window_cntr type ref to if_wd_window_controller,
       lo_window type ref to if_wd_window,
       l_button_text type string.

  lo_view = wd_this->wd_get_api( ).

  lo_window_cntr = lo_view->get_embedding_window_ctlr( ).

  lo_window = lo_window_cntr->get_window( ).

  l_button_text =
     wd_assist->if_wd_component_assistance~get_text( '002' ). "Select Job

  lo_window->set_button_kind( if_wd_window=>co_buttons_okcancel ).

  lo_window->subscribe_to_button_event(
     button            = if_wd_window=>co_button_ok
     button_text       = l_button_text
     action_name       = 'JOB_SELECTED'
     action_view       = lo_view
     is_default_button = abap_true ).

  lo_window->subscribe_to_button_event(
      button            = if_wd_window=>co_button_cancel
      action_name       = 'CANCEL'
      action_view       = lo_view
      is_default_button = abap_false ).

endmethod.

Now my cancel and "Select Job" buttons are sitting all pretty in the bottom right corner of the popup...

Very nice!

ChrisPaine
Active Contributor
0 Kudos

NB both events have to close the window (or not depending on validation)

so need to call the value help listener's close_window method to exit the window -

seems the window was generated with the

close_in_any_case      = abap_false

parameter set. (default I believe is true.)

ChrisPaine
Active Contributor
0 Kudos

Alternatively I could just set it however I want using the

lo_window->set_close_in_any_case( abap_false ).

method.

Sometimes it seems that my new internal windows (freely programmed value helps) were having this set as true as default, and sometimes false. Can't figure out why - there will be a logical answer - but in the meantime the above bit of code ensures that they don't close the window on press of button - allows me to control when they should close.