Skip to Content
0
Former Member
Nov 10, 2005 at 10:39 AM

context menus visible/invisible.-its urgent

72 Views

hi All,

I am using the following context menus in 2 screens. 2 screens are having 2 custom containers and their names are identical in both the screens. there are 5 buttons required in first screen, whereas the second screen doesn't requires a button. i.e., it requires only 4 buttons.

now, what i want is to invisible the button when i enter into the second screen. and it should visible in first screen. how to do this. plz help.

IF go_toolbar_container IS INITIAL.

  • Create container

CREATE OBJECT go_toolbar_container

EXPORTING

container_name = 'MY_CONTAINER'.

  • Create toolbar

CREATE OBJECT go_toolbar

EXPORTING

parent = go_toolbar_container.

  • Add a button

CALL METHOD go_toolbar->add_button

EXPORTING fcode = 'SEL'

icon = icon_select_detail

is_disabled = ' '

butn_type = cntb_btype_button

  • text = 'Exit' "Text on button

quickinfo = 'Select Periods'

is_checked = ' '.

  • Add a seperator

  • IF w_scr_num NE '0103'.

CALL METHOD cl_gui_toolbar=>fill_buttons_data_table

EXPORTING

fcode = 'SEP1'

icon = ' '

disabled = 'X'

butn_type = cntb_btype_sep

CHANGING

data_table = gi_button_group.

CALL METHOD cl_gui_toolbar=>fill_buttons_data_table

EXPORTING fcode = 'INS'

icon = icon_insert_row

disabled = ''

butn_type = cntb_btype_button

quickinfo = 'Insert Row'

checked = ' '

CHANGING

data_table = gi_button_group.

  • Add a seperator

CALL METHOD cl_gui_toolbar=>fill_buttons_data_table

EXPORTING

fcode = 'SEP2'

icon = ' '

disabled = 'X'

butn_type = cntb_btype_sep

CHANGING

data_table = gi_button_group.

CALL METHOD cl_gui_toolbar=>fill_buttons_data_table

EXPORTING fcode = 'DEL'

icon = icon_delete_row

disabled = ' '

butn_type = cntb_btype_button

quickinfo = 'Delete Row'

checked = ' '

CHANGING

data_table = gi_button_group.

  • Add a seperator

CALL METHOD cl_gui_toolbar=>fill_buttons_data_table

EXPORTING

fcode = 'SEP3'

icon = ' '

disabled = 'X'

butn_type = cntb_btype_sep

CHANGING

data_table = gi_button_group.

CALL METHOD cl_gui_toolbar=>fill_buttons_data_table

EXPORTING fcode = 'SALL'

icon = icon_select_all

disabled = ' '

butn_type = cntb_btype_button

quickinfo = 'Select All'

checked = ' '

CHANGING

data_table = gi_button_group.

  • Add a seperator

CALL METHOD cl_gui_toolbar=>fill_buttons_data_table

EXPORTING

fcode = 'SEP4'

icon = ' '

disabled = 'X'

butn_type = cntb_btype_sep

CHANGING

data_table = gi_button_group.

CALL METHOD cl_gui_toolbar=>fill_buttons_data_table

EXPORTING fcode = 'DALL'

icon = icon_deselect_all

disabled = ' '

butn_type = cntb_btype_button

quickinfo = 'Deselect All'

checked = ' '

CHANGING

data_table = gi_button_group.

  • Add button group to toolbar

CALL METHOD go_toolbar->add_button_group

EXPORTING data_table = gi_button_group.

CLEAR g_event.

REFRESH gi_events.

g_event-eventid = go_toolbar->m_id_function_selected.

g_event-appl_event = 'X'. "This is an application event

APPEND g_event TO gi_events.

g_event-eventid = go_toolbar->m_id_dropdown_clicked.

g_event-appl_event = 'X'.

APPEND g_event TO gi_events.

  • Use the events table to register events for the control

CALL METHOD go_toolbar->set_registered_events

EXPORTING

events = gi_events.

  • Create event handlers

CREATE OBJECT go_event_handler.

SET HANDLER go_event_handler->on_function_selected

FOR go_toolbar.

ENDIF.