Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Delayed_changed_sel_callback event

Former Member
0 Kudos

Hi.

How can I do to reduce the delay time?

Now is next to two seconds ...

Thanks in advance.

4 REPLIES 4

uwe_schieferstein
Active Contributor
0 Kudos

Hello Sara

The inherited method SET_DELAY_CHANGE_SELECTION of CL_GUI_ALV_GRID sets the delay time. However, this method is protected.

If you look up the class hierarchy you find a public method IF_CACHED_PROP~SET_PROP of class CL_GUI_OBJECT which is available in CL_GUI_ALV_GRID, too.

Thus, I would first call method IF_CACHED_PROPGET_PROP to retrieve the current setting of the delay time and then change its value using method *IF_CACHED_PROPSET_PROP*.

Property name is: 'DelayTimeChangedSelectionEvent'


METHOD SET_DELAY_CHANGE_SELECTION .
  CALL METHOD SET_PROPERTY
   EXPORTING
     PROPERTY = 'DelayTimeChangedSelectionEvent'
     VALUE = TIME
       EXCEPTIONS
         OTHERS = 1.
    IF SY-SUBRC NE 0.
      RAISE ERROR.
    ENDIF.

ENDMETHOD.

Regards

Uwe

0 Kudos

Hi Uwe.

I test the method but I couldn't because is protected too.

Thanks any way.

Sara.

0 Kudos

Hello Sara

Perhaps my previous answer was misleading you:


" First call GET method to see the current value
CALL METHOD go_grid->IF_CACHED_PROP~GET_PROP
  ...

" Then call SET method to change the value
CALL METHOD go_grid->IF_CACHED_PROP~SET_PROP
  ...

Regards

Uwe

0 Kudos

Hi Sara,

The other way should be just inheriting it into a local class and use its protected method.

I tried to reduce the time to 10 millisecond and it is working!! test code below.

*----------------------------------------------------------------------*
CLASS lcl_alv_wrapper DEFINITION INHERITING FROM cl_gui_alv_grid.
  PUBLIC SECTION.
    METHODS : constructor,
              set_delay_time,
              click FOR EVENT delayed_changed_sel_callback OF cl_gui_alv_grid.
ENDCLASS.                    "lcl_alv_wrapper DEFINITION

*----------------------------------------------------------------------*
CLASS lcl_alv_wrapper IMPLEMENTATION.
  METHOD constructor.
    super->constructor( i_parent = cl_gui_container=>default_screen ).
    SET HANDLER me->click FOR ALL INSTANCES.
  ENDMETHOD.                    "constructor
  METHOD set_delay_time.
    me->set_delay_change_selection( 10 ).
  ENDMETHOD.                    "set_delay_time
  METHOD click.
    MESSAGE 'Hi' TYPE 'I'.
  ENDMETHOD.                    "click
ENDCLASS.                    "lcl_alv_wrapper IMPLEMENTATION

DATA : grid    TYPE REF TO lcl_alv_wrapper,
       table   TYPE STANDARD TABLE OF makt.


PARAMETER dummy.

AT SELECTION-SCREEN OUTPUT.

  CREATE OBJECT grid.

  SELECT * FROM makt INTO CORRESPONDING FIELDS OF TABLE table UP TO 27 ROWS.

  grid->set_table_for_first_display( EXPORTING i_structure_name = 'MAKT'
                                      CHANGING it_outtab       = table ).
  grid->register_delayed_event( i_event_id = cl_gui_alv_grid=>mc_evt_delayed_change_select ).
  grid->set_delay_time( ).

~Jose.