"CONTAINER
DATA: G_CONTAINER1 type ref to CL_GUI_DOCKING_CONTAINER, "MAIN CONTAINER
G_CONTAINER2 type ref to CL_GUI_CONTAINER,
G_CONTAINER3 type ref to cl_gui_container,
G_CONTAINER4 type ref to cl_gui_container,
G_CONTAINER5 type ref to cl_gui_container.
DATA splitter_1 TYPE REF TO CL_GUI_SPLITTER_CONTAINER.
REPORT Z_EX_CONTAINER_SPLITTER NO STANDARD PAGE HEADING
LINE-SIZE 255 LINE-COUNT 65.
DATA: OK_CODE LIKE SY-UCOMM.
"CONTAINER
DATA: G_CONTAINER1 type ref to CL_GUI_DOCKING_CONTAINER, "MAIN CONTAINER
G_CONTAINER2 type ref to CL_GUI_CONTAINER,
G_CONTAINER3 type ref to cl_gui_container,
G_CONTAINER4 type ref to cl_gui_container,
G_CONTAINER5 type ref to cl_gui_container.
DATA splitter_1 TYPE REF TO CL_GUI_SPLITTER_CONTAINER.
START-OF-SELECTION.
CALL SCREEN 0100.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'S0100'.
SET TITLEBAR 'T0100'.
PERFORM CREATE_CONTAINER.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form CREATE_LOCAL_TREE
*&---------------------------------------------------------------------*
* Create Local Tree Node
*----------------------------------------------------------------------*
FORM CREATE_CONTAINER.
DATA: REPID TYPE SY-REPID,
DYNNR TYPE SY-DYNNR.
REPID = SY-REPID.
DYNNR = SY-DYNNR.
"建立 CONTAINER 在目前程式的 SCREEN 0100
CREATE OBJECT G_CONTAINER1
EXPORTING REPID = REPID
DYNNR = DYNNR
SIDE = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_LEFT "靠左
EXTENSION = 99999. "寬度
"建立 Splitter,並設定目前 Splitter 要把 Container 切成四等份
CREATE OBJECT splitter_1
EXPORTING
parent = G_CONTAINER1
rows = 2
columns = 2.
"設定 Splitter 外觀
CALL METHOD splitter_1->SET_ROW_SASH
exporting
id = 1
type = cl_gui_splitter_container=>type_sashvisible
value = cl_gui_splitter_container=>true.
"設定預設 Splitter1 的高度
CALL METHOD splitter_1->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
"getting the reference for the splited container( row 1 & col 1 container )
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = G_CONTAINER2.
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = G_CONTAINER3.
CALL METHOD splitter_1->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = G_CONTAINER4.
CALL METHOD splitter_1->get_container
EXPORTING
row = 2
column = 2
RECEIVING
container = G_CONTAINER5.
ENDFORM. " CREATE_CONTAINER
需要透過 SCREEN 0100 來呈現目前 CONTAINER 與 SPLITTER,並且在 0100 的 MODULE STATUS_0100 OUTPUT.中執行 CREATE_CONTAINER。
透過下面的 SET_ROW_SASH 來設定 Splitter 的樣式
CALL METHOD splitter_1->SET_ROW_SASH
exporting
id = 1
type = cl_gui_splitter_container=>type_sashvisible
value = cl_gui_splitter_container=>true.
不執行上面的程式,預設的樣式如下
CREATE OBJECT G_CONTAINER1
EXPORTING REPID = REPID
DYNNR = DYNNR
SIDE = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_LEFT "靠左
EXTENSION = 99999. "寬度
另外透過下面的語法將目前的 Container 切成四個區塊,再依目前 Splitter 個區塊填入 Container
CREATE OBJECT splitter_1
EXPORTING
parent = G_CONTAINER1
rows = 2
columns = 2.
CALL METHOD splitter_1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = G_CONTAINER2.
沒有留言:
張貼留言