cancel
Showing results for 
Search instead for 
Did you mean: 

Button click?

Former Member
0 Kudos

Hi,

How can I see on what button is clicked on my VIEW?

I have 2 buttons on my view, HIDE and SHOW. When HIDE is clicked I hide table and when SHOW is clicked I show the table.

I use method WDDOMODIFYVIEW .

tnx, Adibo.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Adibo,

Since you already have two buttons, simply create two action handlers and then in action handler for HIDE, write code for hiding the table and in action handler for SHOW, write code for show.

Simple

Regards,

Neha

Answers (4)

Answers (4)

Former Member
0 Kudos

I created an ATTRIBUTE and I binded visible property of TABLE with this ATRIBUTE.

Then OnAction of BUTTONS i created next code.

method ONACTIONHIDE .

DATA lo_el_context TYPE REF TO if_wd_context_element.

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

  • set single attribute

lo_el_context->set_attribute(

EXPORTING

value = '01'

name = `ATR_VISIBLE` ).

endmethod.

method ONACTIONSHOW .

DATA lo_el_context TYPE REF TO if_wd_context_element.

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

  • set single attribute

lo_el_context->set_attribute(

EXPORTING

value = '02'

name = `ATR_VISIBLE` ).

endmethod.

Former Member
0 Kudos

hi Adibo A ,

First thing don't use WDONMODIFYVIEW because it will be called every time some change will occur in view .

Solution : If you will see button properties you will find ON ACTION write some method lets say On_hide_click .

Now write code to may that table invisible in this method ( Simply set visible property false ) .

In similar way write code to make in visible in another method and call it on action of SHOW button

Former Member
0 Kudos

Hi Adibo,

If you are using the class cl_wd_table to manupulate the propery of the table, then you can do that in the modify view only, since its the only method where we can get a focus to the UI Elements,

If you are using the an attribute to manage the visible property of table then you can write code directly on the onaction event of each button.

Regards

Sarath

Former Member
0 Kudos

Hi Adibo,

In the event handler of the button action you have the parameter WDEVENT.

Check out in debug mode

wdevent → parameters:

This internal table contains additional information about the UI element that

fired the event. Store this value in an attribute, so that you can reuse it.

Sankar.

Editing

-


The ID of the UI element that fired the event is always contained in the

table. As I said you can store it in an attribute. You can access this in WDDOMODIFYVIEW. Check which button is clicked and do the necessary code to hide or show the table UI element.

It is highly advisable to do all the UI modifications in the method WDDOMODIFYVIEW.

Edited by: Sankar R on Jan 4, 2008 12:15 PM

Former Member
0 Kudos

Hi Adibo A ,

For doing the table hiding at modify view you have to identify which button is clicked, so create an attribute (eg: button_name), then on the event trigger method of each button you have to set this attribute, like if u press hide set the value of button_name to hide and show for other. then at modify view you can read the attribute button_name and can identify which button is clicked. so you can write condition based on the value of attribute button_name and can hide the table accordingly.

Another alternative for your requirement is like you can create an attribute of type boolean and bind this to the visible property of the table, then you can change the value of the attribute on the event of each button to false or true and the visibility of the table will change accordingly.

Regards ,

Sarath

Reward points if it helps you

Edited by: Sarath Satheesan on Jan 4, 2008 11:45 AM

Former Member
0 Kudos

Hi Sarath,

tnx.

Could you provide me some code, plz..

DATA el_button type REF TO CL_WD_BUTTON.

if not first_time = 'X'.

el_button ?= view->GET_ELEMENT( 'BUTTON_1' ). "BUTTON_1 = HIDE

endif.

Is there something (attribute of something else) in el_button set, so I can see that it is clicked on this BUTTON_1

Former Member
0 Kudos

Hi Adibo,

One thing you can do is , check the parameters in the modify view, some parameter in the itab will tell you which UI element trigger the latest event . you Can make use of that also for your requirement.

Regards

Sarath