Code: Alles auswählen.
* -------------------------------------------------------------
* Creates a toolbar for the viewer which covers almost all
* available functionality.
* -------------------------------------------------------------
method create_toolbar.
data: my_toolbar type ref to cl_gui_toolbar,
btable_row type stb_button,
btable type standard table of stb_button
with non-unique default key initial size 7,
wa like line of btable,
grouptable type ttb_button.
* ------------------------------------------------------------
* prepare the data table, used to create the button group
* within the toolbar
* ------------------------------------------------------------
clear: btable.
clear btable_row.
* --- CLOSE ---
if close_button = 'X'.
btable_row-function = 'FINISHED'.
btable_row-quickinfo = text-043.
btable_row-butn_type = 0.
btable_row-icon = '@3X@'.
append btable_row to btable.
btable_row-icon = ''.
btable_row-function = ''.
btable_row-butn_type = 3.
append btable_row to btable.
endif.
* --- VIEWER ---
if viewer = 'X'.
btable_row-function = 'VIEWER'.
btable_row-quickinfo = text-025.
btable_row-butn_type = 2.
btable_row-text = text-025.
append btable_row to btable.
btable_row-function = ''.
btable_row-butn_type = 3.
append btable_row to btable.
endif.
* --- NAVIGATION ---
if navigation = 'X'.
btable_row-function = 'NAVIGATION'.
btable_row-quickinfo = text-017.
btable_row-butn_type = 2.
btable_row-text = text-017.
append btable_row to btable.
btable_row-function = ''.
btable_row-butn_type = 3.
append btable_row to btable.
endif.
* --- TOOLS ---
if tools = 'X'.
btable_row-function = 'TOOLS'.
btable_row-quickinfo = text-035.
btable_row-butn_type = 2.
btable_row-text = text-035.
append btable_row to btable.
btable_row-function = ''.
btable_row-butn_type = 3.
append btable_row to btable.
endif.
* --- OPTIONS ---
if options = 'X'.
btable_row-function = 'OPTIONS'.
btable_row-quickinfo = text-024.
btable_row-butn_type = 2.
btable_row-text = text-024.
append btable_row to btable.
btable_row-function = ''.
btable_row-butn_type = 3.
append btable_row to btable.
endif.
* --- REMOVE DOCUMENT ---
if remove_document = 'X'.
btable_row-function = 'REMOVE'.
btable_row-quickinfo = text-075.
btable_row-text = ''.
btable_row-butn_type = 0.
btable_row-icon = '@11@'.
append btable_row to btable.
btable_row-icon = ''.
btable_row-function = ''.
btable_row-butn_type = 3.
append btable_row to btable.
endif.
* ---------------------------------------------------------------
* the toolbar object is created
* and the button group table containing the button data is filled
* ---------------------------------------------------------------
create object my_toolbar
exporting
parent = me->parent
exceptions
cntl_error = 1
cntl_install_error = 2
others = 3.
case sy-subrc.
when 0.
"ok
when 1.
raise cntl_error.
when 2.
raise cntl_system_error.
when others.
raise cntl_error.
endcase.
me->my_toolbar = my_toolbar.
loop at btable into wa.
call method my_toolbar->fill_buttons_data_table
exporting
fcode = wa-function
icon = wa-icon
butn_type = wa-butn_type
text = wa-text
quickinfo = wa-quickinfo
changing
data_table = grouptable
exceptions
cntb_btype_error = 1.
if sy-subrc <> 0.
raise cntb_btype_error.
endif.
endloop.
* ----------------------------------------------------
* create button group, using the data table
* ----------------------------------------------------
call method my_toolbar->add_button_group
exporting
data_table = grouptable
exceptions
dp_error = 1
cntb_error_fcode = 2.
case sy-subrc.
when 0.
"ok
when 1.
raise dp_error.
when 2.
raise wrong_fcode_error.
when others.
raise cntl_error.
endcase.
call method parent->set_focus
exporting
control = my_toolbar
exceptions
cntl_error = 1
cntl_system_error = 2
others = 3.
if sy-subrc <> 0.
"failed
endif.
call method my_toolbar->set_alignment
exporting
alignment = 7
exceptions
cntl_error = 1
cntl_system_error = 2
others = 3.
if sy-subrc <> 0.
"failed
endif.
call method me->set_alignment
exporting
alignment = 11
exceptions
cntl_error = 1
cntl_system_error = 2
others = 3.
if sy-subrc <> 0.
"failed
endif.
call method my_toolbar->set_position
exporting
top = 0
left = 0
width = 1000
height = 12
exceptions
cntl_error = 1
cntl_system_error = 2
others = 3.
if sy-subrc <> 0.
"failed
endif.
data: my_height type i,
my_width type i.
call method me->get_height
importing
height = my_height
exceptions
cntl_error = 1
others = 2.
if sy-subrc <> 0.
"failed
endif.
call method me->get_width
importing
width = my_width
exceptions
cntl_error = 1
others = 2.
if sy-subrc <> 0.
"failed
endif.
Code: Alles auswählen.
call method cl_gui_cfw=>flush
Code: Alles auswählen.
exceptions
cntl_error = 1
cntl_system_error = 2
others = 3.
if sy-subrc <> 0.
message i001(ECLVIEWER) with text-060.
endif.
my_height = my_height - 5.
call method me->set_position
exporting
top = 12
left = 0
width = my_width
height = my_height
exceptions
cntl_error = 1
cntl_system_error = 2
others = 3.
if sy-subrc <> 0.
message i001(ECLVIEWER) with text-061.
endif.
* ----------------------------------------------------
* register toolbar events
* ----------------------------------------------------
call method me->register_toolbar_events
exporting
my_toolbar = my_toolbar
viewer_openfile = viewer_openfile
viewer_savefile = viewer_savefile
tool_measurement = tool_measurement.
endmethod.
Code: Alles auswählen.
* INCLUDE LCV121F12
* ab Zeile 34
...
CALL METHOD cl_exithandler=>get_instance
EXPORTING
exit_name = 'DOCUMENT_ECL01'
null_instance_accepted = seex_true
IMPORTING
act_imp_existing = lf_act_imp_existing
CHANGING
instance = lf_exit.
IF NOT lf_act_imp_existing IS INITIAL.
CALL METHOD lf_exit->show_doc_meta_data
EXPORTING: draw = ps_draw
filename = pf_file
loio = pf_loio
phio = pf_phio
appnr = pf_appnr
viewer = gf_view_2d
IMPORTING: meta_data = lt_data
x_position = lf_x
y_position = lf_y
size = lf_size
color = lf_color
transparent = lf_transparent
font = lf_font.
ENDIF.
...
Code: Alles auswählen.
**INCLUDE
**LCV121F02
**Ab Zeile 93
* Call exit to define available functions
lf_save = 'X'.
IF NOT gf_impl_document_ecl01 IS INITIAL.
CALL METHOD gf_impl_document_ecl01->before_initialize
EXPORTING: control_name = pf_control_name
draw = gs_draw
CHANGING: open_file_active = lf_open
save_file_active = lf_save.
ENDIF.
CALL METHOD gf_view_2d->create_toolbar
EXPORTING tools = pf_tools
viewer_openfile = lf_open
viewer_savefile = lf_save
EXCEPTIONS OTHERS = 01.
IF pf_tools = 'X'.
gf_view_2d->for_dvs = 'X'.
gf_view_2d->ask_for_layer_name = 'X'.
ENDIF.
ENDIF.
pfx_control = gf_view_2d.
* if there is already 3D-Viewer -> set it invisible
der 'dirty assign' dürfte aber nur funktionieren, wenn die gewünschte Variable global definiert ist.Hermann hat geschrieben:@Manuela: Welchen zusätzlichen Parameter möchtest Du denn in der Schnittstelle des Badis zur Verfügung haben? Gibt es diesen Parameter denn überhaupt außerhalb des Badis?
Falls ja, könntest Du diesen Parameter ggf. auch über einen 'dirty assign' verändern.
Ein Beispiel wie das funktioniert findest Du in diesem Thread (unten):
http://www.abapforum.com/forum/viewtopic.php?t=573
Hermann