‎2006 Jul 27 9:53 PM
Hi,
I have a dialog that contains an ALV grid and three buttons. When the ALV grid is created, it's parent is specified as a custom container.
Container
data : g_custom_container type ref to cl_gui_custom_container.
ALV Grid
data : g_grid type ref to cl_gui_alv_grid.
create object g_custom_container
exporting container_name = p_cont_name.
create object g_grid
exporting i_parent = g_custom_container
I_APPL_EVENTS = 'X'.
I would like the user to be able to just hit enter to accept the values displayed in the ALV. My problem is that when the dialog is created, the ALV has focus so the event isn't getting to the PAI of the dialog. If I click the mouse outside of the ALV to take focus away from the ALV, hitting the enter key does trigger the correct event in the dialog PAI. How can I either set the focus outside of the ALV when the dialog loads, or make the ALV forward the event to the dialog.
Thank you very much for any isight you can lend!
John Richason
‎2006 Jul 27 10:22 PM
Hi,
Register these events for Grid to enable 'enter'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = cl_gui_alv_grid=>mc_evt_modified.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = cl_gui_alv_grid=>mc_evt_enter.
Method to set focus on a particular cell of the ALV
CL_GUI_ALV_GRID ->set_current_cell_via_id.
Regards
Appana
‎2006 Jul 27 11:09 PM
Hi Appana,
Thank you for your fast response. Will these enable the enter event for the ALV? How do I get the event to the screen PAI afterwards?
Thanks again,
John
‎2006 Jul 27 11:17 PM
Hi John, are you working with an editable ALV grid? If so, the code below will allow an event to be fired when the user hits enter after the data has been changed.
call method alv_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.You then need to create an event handler to handle the event being fired when the data is changed.
* create Event Receiver
create object event_receiver.
* handler for ALV grid
set handler event_receiver->handle_data_changed for alv_grid.REgards,
Rich Heilman
‎2006 Jul 27 11:18 PM
‎2006 Jul 28 3:48 PM
Thank you for your suggestions. It turned out that the person who initially wrote the code was creating a second grid object without removing the first one.
Thanks again,
John