Tree Control 是最常用的Windows控件之一,在其他语言中成为"Tree View"等,ABAP的 Tree Contiol 能实现类似的功能。

本文主要介绍一下内容:

1. 实例一个简单的 Tree Control,双击取得节点的Key 和 TEXT

2. 建立有数据表接口的Tree Control 对象

3. 通过右键菜单实现 Tree Control节点的 增 删 改 功能

4. Tree Control对象与ALV Grid对象关联

××××××××××××××××××××华丽的分割线×××××××××××××××××××××××

BEGIN

(一)实例一个简单的 Tree Control,双击取得节点的Key 和 TEXT.

1. 创建一个ABAP程序

2. 在程序中添加一个屏幕100,使用屏幕制作器,建立Screen,添加屏幕对象

创建好的屏幕和对象界面如图:

屏幕元素清单

 逻辑流程序

  

PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.

主程序

  1 *&---------------------------------------------------------------------*
2 *& Report ZHAIM_TREE_CONTROL
3 *&
4 *&---------------------------------------------------------------------*
5 *&
6 *&
7 *&---------------------------------------------------------------------*
8
9 REPORT ZHAIM_TREE_CONTROL.
10 * 功能码
11 DATA: OK_CODE TYPE SY-UCOMM,
12 SAVE_OK TYPE SY-UCOMM.
13 * key text
14 DATA: NODEKEY(20) TYPE C,
15 NODETXT(20) TYPE C.
16
17 * 定制控制对象
18 DATA: WA_CONTAINER TYPE SCRFNAME VALUE 'TREE',
19 * 客户对象
20 WA_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
21 * 实例化对象
22 WA_TREE TYPE REF TO CL_GUI_SIMPLE_TREE.
23 * 节点信息表
24 DATA: IT_NODETABLE LIKE TABLE OF MTREESNODE,
25 IW_NODETABLE TYPE MTREESNODE.
26
27 DATA WA_SPFLI TYPE TABLE OF SPFLI.
28
29 *创建一个类,实现一个双击方法
30 CLASS LCL_APPLICATION DEFINITION DEFERRED.
31
32 *&---------------------------------------------------------------------*
33 *& Class (DEFINITION) LCL_APPLICATION
34 *&---------------------------------------------------------------------*
35 * Text
36 *----------------------------------------------------------------------*
37 CLASS LCL_APPLICATION DEFINITION.
38 PUBLIC SECTION.
39 METHODS HANDLE_NODE_DOUBLE_CLICK
40 FOR EVENT NODE_DOUBLE_CLICK
41 OF CL_GUI_SIMPLE_TREE
42 IMPORTING NODE_KEY.
43 ENDCLASS. "LCL_APPLICATION
44 *&---------------------------------------------------------------------*
45 *& Class (Implementation) LCL_APPLICATION
46 *&---------------------------------------------------------------------*
47 * Text
48 *----------------------------------------------------------------------*
49 CLASS LCL_APPLICATION IMPLEMENTATION.
50
51 METHOD HANDLE_NODE_DOUBLE_CLICK.
52
53 NODEKEY = NODE_KEY.
54
55 READ TABLE IT_NODETABLE WITH KEY NODE_KEY = NODE_KEY INTO IW_NODETABLE.
56
57 NODETXT = IW_NODETABLE-TEXT.
58 ENDMETHOD.
59
60 ENDCLASS. "LCL_APPLICATION
61
62 * 双击方法的类的实例化对象 准备在PBO中分配给TREE对象
63 DATA: G_APPLICATION TYPE REF TO LCL_APPLICATION.
64
65
66 START-OF-SELECTION.
67
68 CREATE OBJECT G_APPLICATION.
69
70 CALL SCREEN 100.
71
72
73 *&---------------------------------------------------------------------*
74 *& Module USER_COMMAND_0100 INPUT
75 *&---------------------------------------------------------------------*
76 * text
77 *----------------------------------------------------------------------*
78 MODULE USER_COMMAND_0100 INPUT.
79
80 SAVE_OK = OK_CODE.
81
82 CLEAR OK_CODE.
83
84 CASE SAVE_OK.
85 WHEN 'BACK'.
86 LEAVE PROGRAM.
87 WHEN OTHERS.
88 ENDCASE.
89
90 ENDMODULE. " USER_COMMAND_0100 INPUT
91 *&---------------------------------------------------------------------*
92 *& Module STATUS_0100 OUTPUT
93 *&---------------------------------------------------------------------*
94 * text
95 *----------------------------------------------------------------------*
96 MODULE STATUS_0100 OUTPUT.
97 SET PF-STATUS 'TREECTRL_GUIS'.
98 SET TITLEBAR 'TREE CONTROL'.
99 IF WA_CUSTOM_CONTAINER IS INITIAL.
100 PERFORM FRM_CREATE_TREE.
101 ENDIF.
102 ENDMODULE. " STATUS_0100 OUTPUT
103
104 *&---------------------------------------------------------------------*
105 *& Form FRM_CREATE_TREE
106 *&---------------------------------------------------------------------*
107 * text
108 *----------------------------------------------------------------------*
109 * --> p1 text
110 * <-- p2 text
111 *----------------------------------------------------------------------*
112 FORM FRM_CREATE_TREE .
113 DATA: EVENTS TYPE CNTL_SIMPLE_EVENTS,
114 EVENT1 TYPE CNTL_SIMPLE_EVENT.
115 * 定制控制对象,指定tree control的容器
116 CREATE OBJECT WA_CUSTOM_CONTAINER
117 EXPORTING
118 * PARENT =
119 CONTAINER_NAME = WA_CONTAINER " 定制对象名:TREE
120 * STYLE =
121 * LIFETIME = lifetime_default
122 * REPID =
123 * DYNNR =
124 * NO_AUTODEF_PROGID_DYNNR =
125 EXCEPTIONS
126 CNTL_ERROR = 1
127 CNTL_SYSTEM_ERROR = 2
128 CREATE_ERROR = 3
129 LIFETIME_ERROR = 4
130 LIFETIME_DYNPRO_DYNPRO_LINK = 5
131 others = 6
132 .
133
134 IF SY-SUBRC <> 0.
135 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
136 * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
137 ENDIF.
138
139 * 定义树对象
140 CREATE OBJECT WA_TREE
141 EXPORTING
142 * LIFETIME =
143 PARENT = WA_CUSTOM_CONTAINER
144 * SHELLSTYLE =
145 NODE_SELECTION_MODE = CL_GUI_SIMPLE_TREE=>NODE_SEL_MODE_SINGLE
146 * HIDE_SELECTION =
147 * NAME =
148 EXCEPTIONS
149 LIFETIME_ERROR = 1
150 CNTL_SYSTEM_ERROR = 2
151 CREATE_ERROR = 3
152 FAILED = 4
153 ILLEGAL_NODE_SELECTION_MODE = 5
154 others = 6
155 .
156 IF SY-SUBRC <> 0.
157 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
158 * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
159 ENDIF.
160
161 * 通过宏定义树 节点
162 DEFINE CREATE_TREE.
163
164 CLEAR IW_NODETABLE.
165
166 IW_NODETABLE-NODE_KEY = &1. "节点KEY值
167 IW_NODETABLE-RELATKEY = &2. "相关联的节点KEY值
168 IW_NODETABLE-RELATSHIP = &3. "关联关系
169 IW_NODETABLE-HIDDEN = &4.
170 IW_NODETABLE-DISABLED = &5.
171 IW_NODETABLE-ISFOLDER = &6. "文件夹形式
172 * 图标,可以运行程序 SHOWICON 查阅
173 IW_NODETABLE-N_IMAGE = &7. "图标
174 IW_NODETABLE-EXP_IMAGE = &7. "图标
175 * IW_NODETABLE-EXPANDER.
176 IW_NODETABLE-TEXT = &8. "节点文本
177
178 APPEND IW_NODETABLE TO IT_NODETABLE.
179
180 END-OF-DEFINITION.
181
182 CREATE_TREE 'CN' '' ''
183 '' '' 'X' '' '中国'.
184 CREATE_TREE 'BEIJING' 'CN' CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD '' '' 'X' '' '北京'.
185 CREATE_TREE 'FENGTAI' 'BEIJING' CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD '' '' '' '@6G@' '丰台区'.
186 CREATE_TREE 'HAIDIAN' 'BEIJING' CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD '' '' '' '@6G@' '海淀区'.
187 CREATE_TREE 'CHAOYANG' 'BEIJING' CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD '' '' '' '@6G@' '朝阳区'.
188 CREATE_TREE 'DONGCHENG' 'BEIJING' CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD '' '' '' '@6G@' '东城区'.
189
190 CREATE_TREE 'SHENGHAI' 'CN' CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD '' '' 'X' '' '上海'.
191 CREATE_TREE 'QINGPU' 'SHENGHAI' CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD '' '' '' '@6F@' '青浦区'.
192 CREATE_TREE 'HONGKOU' 'SHENGHAI' CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD '' '' '' '@6F@' '虹口区'.
193 CREATE_TREE 'HUANGPU' 'SHENGHAI' CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD '' '' '' '@6F@' '黄浦区'.
194
195 * 为TREE对象添加节点
196 CALL METHOD WA_TREE->ADD_NODES
197 EXPORTING
198 TABLE_STRUCTURE_NAME = 'MTREESNODE'
199 NODE_TABLE = IT_NODETABLE
200 * EXCEPTIONS
201 * ERROR_IN_IT_NODETABLE = 1
202 * FAILED = 2
203 * DP_ERROR = 3
204 * TABLE_STRUCTURE_NAME_NOT_FOUND = 4
205 * others = 5
206 .
207 IF SY-SUBRC <> 0.
208 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
209 * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
210 ENDIF.
211
212 *定义双击事件
213 EVENT1-EVENTID = CL_GUI_SIMPLE_TREE=>EVENTID_NODE_DOUBLE_CLICK.
214 EVENT1-APPL_EVENT = 'X'.
215 APPEND EVENT1 TO EVENTS.
216
217 * 添加事件内表
218 CALL METHOD WA_TREE->SET_REGISTERED_EVENTS
219 EXPORTING
220 EVENTS = EVENTS
221 EXCEPTIONS
222 CNTL_ERROR = 1
223 CNTL_SYSTEM_ERROR = 2
224 ILLEGAL_EVENT_COMBINATION = 3
225 others = 4
226 .
227 IF SY-SUBRC <> 0.
228 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
229 * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
230 ENDIF.
231 * 将已定义的双击事件分配到树对象
232 SET HANDLER G_APPLICATION->HANDLE_NODE_DOUBLE_CLICK FOR WA_TREE.
233 ENDFORM. " FRM_CREATE_TREE

(二) 建立有数据接口的Tree Control 对象

从数据表中读取结构,并按照数据关系建立Tree Control,

提一下思路,不做具体事例。。。

将需要的表结构存储到内表中,然后LOOP这张内表,循环调用宏来填充节点内表:例如

DEFINE  CREATE_TREE.

  CLEAR IW_NODETABLE.

  IW_NODETABLE-NODE_KEY = &1.         "节点KEY值
IW_NODETABLE-RELATKEY = &2. "相关联的节点KEY值
IW_NODETABLE-RELATSHIP = &3. "关联关系
IW_NODETABLE-HIDDEN = &4.
IW_NODETABLE-DISABLED = &5.
IW_NODETABLE-ISFOLDER = &6. "文件夹形式
* 图标,可以运行程序 SHOWICON 查阅
IW_NODETABLE-N_IMAGE = &7. "图标
IW_NODETABLE-EXP_IMAGE = &7. "图标
* IW_NODETABLE-EXPANDER.
IW_NODETABLE-TEXT = &8. "节点文本 APPEND IW_NODETABLE TO IT_NODETABLE. END-OF-DEFINITION. LOOP AT <ITAB> INTO <WA>.
"循环调用宏
CREATE_TREE ' ' ' ' ' ' ' ' ' ' .
...
ENDLOOP.

这样节点情况,也会根据数据情况来动态变化。

(三)通过右键菜单实现 Tree Control节点的 增 删 改 功能

在OO的类中,添加两个方法

*&---------------------------------------------------------------------*
*& Class (DEFINITION) LCL_APPLICATION
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
CLASS LCL_APPLICATION DEFINITION.
PUBLIC SECTION. METHODS: HANDLE_NODE_DOUBLE_CLICK
FOR EVENT NODE_DOUBLE_CLICK
OF CL_GUI_SIMPLE_TREE
IMPORTING NODE_KEY,
* 构成右键菜单的方法 HANDLE_NODE_CONTEXT_MENU_REQ
FOR EVENT NODE_CONTEXT_MENU_REQUEST
OF CL_GUI_SIMPLE_TREE
IMPORTING NODE_KEY MENU,
* 响应右键菜单的方法
HANDLE_NODE_CONTEXT_MENU_SEL
FOR EVENT NODE_CONTEXT_MENU_SELECT
OF CL_GUI_SIMPLE_TREE
IMPORTING NODE_KEY FCODE. ENDCLASS. "LCL_APPLICATION

方法的实现

*&---------------------------------------------------------------------*
*& Class (Implementation) LCL_APPLICATION
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
CLASS LCL_APPLICATION IMPLEMENTATION. METHOD HANDLE_NODE_DOUBLE_CLICK.
READ TABLE IT_NODETABLE WITH KEY NODE_KEY = NODE_KEY INTO IW_NODETABLE.
L_KUNNRK = IW_NODETABLE-NODE_KEY.
L_VTWEGK = IW_NODETABLE-RELATKEY.
CLEAR IW_NODETABLE. READ TABLE IT_NODETABLE WITH KEY NODE_KEY = L_VTWEGK INTO IW_NODETABLE.
L_VKORGK = IW_NODETABLE-RELATKEY.
CLEAR IW_NODETABLE. PERFORM FRM_GET_DATA USING L_KUNNRK L_VTWEGK L_VKORGK. CALL METHOD WA_ALVG->REFRESH_TABLE_DISPLAY
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
* EXCEPTIONS
* FINISHED = 1
* others = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. ENDMETHOD. METHOD HANDLE_NODE_CONTEXT_MENU_REQ.
CALL METHOD MENU->ADD_FUNCTION
EXPORTING
TEXT = '增加本级节点'
FCODE = 'CODE1'. CALL METHOD MENU->ADD_FUNCTION
EXPORTING
TEXT = '增加子节点'
FCODE = 'CODE2'. CALL METHOD MENU->ADD_FUNCTION
EXPORTING
TEXT = '修改当前节点'
FCODE = 'CODE3'. CALL METHOD MENU->ADD_FUNCTION
EXPORTING
TEXT = '删除当前节点'
FCODE = 'CODE4'.
ENDMETHOD. METHOD HANDLE_NODE_CONTEXT_MENU_SEL. DATA STR1 TYPE TV_NODEKEY. CALL METHOD WA_TREE->GET_SELECTED_NODE
IMPORTING
NODE_KEY = STR1. IF SY-SUBRC = 0. READ TABLE IT_NODETABLE WITH KEY NODE_KEY = STR1 INTO IW_NODETABLE. IF FCODE = 'CODE4'.
CALL METHOD WA_TREE->DELETE_NODE
EXPORTING
NODE_KEY = IW_NODETABLE-NODE_KEY
.
DELETE IT_NODETABLE WHERE NODE_KEY = IW_NODETABLE-NODE_KEY.
ENDIF. ENDIF. ENDMETHOD.
ENDCLASS. "LCL_APPLICATION

(四) Tree Control对象与ALV Grid对象关联

附,源代码:

 *&---------------------------------------------------------------------*
*& Report ZHAIM_TREE_CONTROL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* REPORT ZHAIM_TREE_CONTROL.
* 功能码
DATA: OK_CODE TYPE SY-UCOMM,
SAVE_OK TYPE SY-UCOMM. * 定制控制对象
DATA: WA_CONTAINER TYPE SCRFNAME VALUE 'TREE',
WA_CONTAINERA TYPE SCRFNAME VALUE 'ALVG',
* 客户对象
WA_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
WA_CUSTOM_CNTNRALVG TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
* 实例化对象
WA_TREE TYPE REF TO CL_GUI_SIMPLE_TREE,
WA_ALVG TYPE REF TO CL_GUI_ALV_GRID.
* 节点信息表
DATA: IT_NODETABLE TYPE STANDARD TABLE OF MTREESNODE,
IW_NODETABLE TYPE MTREESNODE. DATA: IS_LAYOUT TYPE LVC_S_LAYO,
IT_FIELDCAT TYPE STANDARD TABLE OF LVC_S_FCAT,
IW_FIELDCAT LIKE LINE OF IT_FIELDCAT . TYPES:BEGIN OF TY_VBAK ,
VKORG TYPE VBAK-VKORG ,
VTWEG TYPE VBAK-VTWEG ,
KUNNR TYPE VBAK-KUNNR ,
VBELN TYPE VBAK-VBELN ,
VKORGT TYPE TVKOT-VTEXT,
VTWEGT TYPE TVTWT-VTEXT,
END OF TY_VBAK . DATA: IT_VBAK TYPE STANDARD TABLE OF TY_VBAK,
IW_VBAK TYPE TY_VBAK. TYPES: BEGIN OF TY_VBAP ,
VBELN TYPE VBAP-VBELN ,
POSNR TYPE VBAP-POSNR ,
MATNR TYPE VBAP-MATNR ,
NETWR TYPE VBAP-NETWR ,
WERKS TYPE VBAP-WERKS ,
LSMENG TYPE VBAP-LSMENG ,
END OF TY_VBAP . DATA: IT_VBAP TYPE STANDARD TABLE OF TY_VBAP,
IW_VBAP TYPE TY_VBAP. DATA GS_LAYOUT TYPE LVC_S_LAYO.
DATA GT_FIELDCAT TYPE STANDARD TABLE OF LVC_S_FCAT .
DATA GW_FIELDCAT LIKE LINE OF GT_FIELDCAT .
* 通过宏定义树 节点
DEFINE CREATE_TREE. CLEAR IW_NODETABLE. IW_NODETABLE-NODE_KEY = &. "节点KEY值
IW_NODETABLE-RELATKEY = &. "相关联的节点KEY值
IW_NODETABLE-RELATSHIP = &. "关联关系
IW_NODETABLE-HIDDEN = &.
IW_NODETABLE-DISABLED = &.
IW_NODETABLE-ISFOLDER = &. "文件夹形式
* 图标,可以运行程序 SHOWICON 查阅
IW_NODETABLE-N_IMAGE = &. "图标
IW_NODETABLE-EXP_IMAGE = &. "图标
IW_NODETABLE-TEXT = &. "节点文本 CLEAR IW_NODETABLE-EXPANDER. APPEND IW_NODETABLE TO IT_NODETABLE. END-OF-DEFINITION.
*创建一个类,实现一个双击方法
CLASS LCL_APPLICATION DEFINITION DEFERRED. *&---------------------------------------------------------------------*
*& Class (DEFINITION) LCL_APPLICATION
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
CLASS LCL_APPLICATION DEFINITION .
PUBLIC SECTION. DATA: L_KUNNRK TYPE VBAK-KUNNR,
L_VTWEGK TYPE VBAK-VTWEG,
L_VKORGK TYPE VBAK-VKORG. METHODS:
"双击方法
HANDLE_NODE_DOUBLE_CLICK
FOR EVENT NODE_DOUBLE_CLICK OF CL_GUI_SIMPLE_TREE
IMPORTING NODE_KEY,
"ALV toolbar
HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE,
"响应 toolbar功能的方法
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM,
"响应热键
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID,
"构成右键菜单
HANDLE_NODE_CONTEXT_MENU_REQ
FOR EVENT NODE_CONTEXT_MENU_REQUEST OF CL_GUI_SIMPLE_TREE
IMPORTING NODE_KEY MENU,
"获取右键所选择的节点node_key
HANDLE_NODE_CONTEXT_MENU_SEL
FOR EVENT NODE_CONTEXT_MENU_SELECT OF CL_GUI_SIMPLE_TREE
IMPORTING NODE_KEY FCODE, HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW. ENDCLASS. "LCL_APPLICATION
*&---------------------------------------------------------------------*
*& Class (Implementation) LCL_APPLICATION
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
CLASS LCL_APPLICATION IMPLEMENTATION. METHOD HANDLE_NODE_DOUBLE_CLICK.
READ TABLE IT_NODETABLE WITH KEY NODE_KEY = NODE_KEY INTO IW_NODETABLE.
L_KUNNRK = IW_NODETABLE-NODE_KEY.
L_VTWEGK = IW_NODETABLE-RELATKEY.
CLEAR IW_NODETABLE. READ TABLE IT_NODETABLE WITH KEY NODE_KEY = L_VTWEGK INTO IW_NODETABLE.
L_VKORGK = IW_NODETABLE-RELATKEY.
CLEAR IW_NODETABLE. PERFORM FRM_GET_DATA USING L_KUNNRK L_VTWEGK L_VKORGK. CALL METHOD WA_ALVG->REFRESH_TABLE_DISPLAY . IF SY-SUBRC <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMETHOD. METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
CLEAR LS_TOOLBAR-BUTN_TYPE.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR LS_TOOLBAR. CLEAR LS_TOOLBAR.
LS_TOOLBAR-FUNCTION = 'SHOW_DATA'.
LS_TOOLBAR-ICON = ICON_PPE_VNODE.
LS_TOOLBAR-QUICKINFO = '明细信息'.
LS_TOOLBAR-TEXT = '明细信息'.
IF IT_VBAP IS INITIAL.
LS_TOOLBAR-DISABLED = 'X'.
ENDIF. APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR. CLEAR LS_TOOLBAR.
LS_TOOLBAR-FUNCTION = 'INFO'.
LS_TOOLBAR-ICON = ICON_PPE_VNODE.
LS_TOOLBAR-QUICKINFO = '信息'.
LS_TOOLBAR-TEXT = '信息'.
LS_TOOLBAR-DISABLED = 'X'.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD. METHOD HANDLE_USER_COMMAND.
DATA: LT_ROWS TYPE LVC_T_ROW.
CASE E_UCOMM.
WHEN 'SHOW_DATA'.
CALL METHOD WA_ALVG->GET_SELECTED_ROWS
IMPORTING
ET_INDEX_ROWS = LT_ROWS
* ET_ROW_NO =
.
CALL METHOD CL_GUI_CFW=>FLUSH
* EXCEPTIONS
* CNTL_SYSTEM_ERROR = 1
* CNTL_ERROR = 2
* others = 3
.
IF LT_ROWS IS INITIAL.
MESSAGE S001() WITH '请选择行'.
ELSE.
PERFORM FRM_DETAILS TABLES LT_ROWS.
ENDIF. ENDCASE.
ENDMETHOD. METHOD HANDLE_HOTSPOT_CLICK. PERFORM FRM_HOTSPOT USING E_ROW_ID. ENDMETHOD.
METHOD HANDLE_NODE_CONTEXT_MENU_REQ.
CALL METHOD MENU->ADD_FUNCTION
EXPORTING
TEXT = '增加本级节点'
FCODE = 'CODE1'. CALL METHOD MENU->ADD_FUNCTION
EXPORTING
TEXT = '增加子节点'
FCODE = 'CODE2'. CALL METHOD MENU->ADD_FUNCTION
EXPORTING
TEXT = '修改当前节点'
FCODE = 'CODE3'. CALL METHOD MENU->ADD_FUNCTION
EXPORTING
TEXT = '删除当前节点'
FCODE = 'CODE4'.
ENDMETHOD. METHOD HANDLE_NODE_CONTEXT_MENU_SEL.
DATA STR1 TYPE TV_NODEKEY.
CALL METHOD WA_TREE->GET_SELECTED_NODE
IMPORTING
NODE_KEY = STR1. IF SY-SUBRC = .
READ TABLE IT_NODETABLE WITH KEY NODE_KEY = STR1 INTO IW_NODETABLE.
IF FCODE = 'CODE4'.
CALL METHOD WA_TREE->DELETE_NODE
EXPORTING
NODE_KEY = IW_NODETABLE-NODE_KEY
.
DELETE IT_NODETABLE WHERE NODE_KEY = IW_NODETABLE-NODE_KEY.
ENDIF.
ENDIF.
ENDMETHOD. METHOD HANDLE_DOUBLE_CLICK.
PERFORM FRM_DBLCLICK USING E_ROW.
ENDMETHOD.
ENDCLASS. "LCL_APPLICATION * 双击方法的类的实例化对象 准备在PBO中分配给TREE对象
DATA: G_APPLICATION TYPE REF TO LCL_APPLICATION. START-OF-SELECTION. "创建类对象
CREATE OBJECT G_APPLICATION. PERFORM FRM_GET_NODE_DATA.
CALL SCREEN . *&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'TREECTRL_GUIS'.
SET TITLEBAR 'TREE CONTROL'.
IF WA_CUSTOM_CONTAINER IS INITIAL.
PERFORM FRM_CREATE_TREE.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT *&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT. SAVE_OK = OK_CODE. CLEAR OK_CODE. CASE SAVE_OK.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE. ENDMODULE. " USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------*
*& Form FRM_CREATE_TREE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FRM_CREATE_TREE .
DATA: EVENTS TYPE CNTL_SIMPLE_EVENTS,
EVENT1 TYPE CNTL_SIMPLE_EVENT. * 定制控制对象,指定tree control的容器
CREATE OBJECT WA_CUSTOM_CONTAINER
EXPORTING
* PARENT =
CONTAINER_NAME = WA_CONTAINER " 定制对象名:TREE
* STYLE =
* LIFETIME = lifetime_default
* REPID =
* DYNNR =
* NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR =
CNTL_SYSTEM_ERROR =
CREATE_ERROR =
LIFETIME_ERROR =
LIFETIME_DYNPRO_DYNPRO_LINK =
OTHERS =
. IF SY-SUBRC <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. * 定制控制对象,指定ALV 的容器
CREATE OBJECT WA_CUSTOM_CNTNRALVG
EXPORTING
* PARENT =
CONTAINER_NAME = WA_CONTAINERA
* STYLE =
* LIFETIME = lifetime_default
* REPID =
* DYNNR =
* NO_AUTODEF_PROGID_DYNNR =
* EXCEPTIONS
* CNTL_ERROR = 1
* CNTL_SYSTEM_ERROR = 2
* CREATE_ERROR = 3
* LIFETIME_ERROR = 4
* LIFETIME_DYNPRO_DYNPRO_LINK = 5
* others = 6
.
IF SY-SUBRC <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. * 定义树对象
CREATE OBJECT WA_TREE
EXPORTING
* LIFETIME =
PARENT = WA_CUSTOM_CONTAINER
* SHELLSTYLE =
NODE_SELECTION_MODE = CL_GUI_SIMPLE_TREE=>NODE_SEL_MODE_SINGLE
* HIDE_SELECTION =
* NAME =
EXCEPTIONS
LIFETIME_ERROR =
CNTL_SYSTEM_ERROR =
CREATE_ERROR =
FAILED =
ILLEGAL_NODE_SELECTION_MODE =
others =
.
IF SY-SUBRC <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. * 定义ALV对象 CREATE OBJECT WA_ALVG
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
I_PARENT = WA_CUSTOM_CNTNRALVG
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
* I_FCAT_COMPLETE = SPACE
* EXCEPTIONS
* ERROR_CNTL_CREATE = 1
* ERROR_CNTL_INIT = 2
* ERROR_CNTL_LINK = 3
* ERROR_DP_CREATE = 4
* others = 5
.
IF SY-SUBRC <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. DATA: L_VKORGT TYPE TVKOT-VTEXT,
L_VTWEGT TYPE TVTWT-VTEXT,
L_VKORG TYPE VBAK-VKORG,
L_VTWEG TYPE VBAK-VTWEG,
L_KUNNR TYPE VBAK-KUNNR. LOOP AT IT_VBAK INTO IW_VBAK.
L_VKORG = IW_VBAK-VKORG.
L_VTWEG = IW_VBAK-VTWEG.
L_KUNNR = IW_VBAK-KUNNR.
L_VKORGT = IW_VBAK-VKORGT.
L_VTWEGT = IW_VBAK-VTWEGT. CREATE_TREE L_VKORG '' '' '' '' 'X' '' L_VKORGT.
CREATE_TREE L_VTWEG L_VKORG '' '' 'X' '' L_VTWEGT.
CREATE_TREE L_KUNNR L_VTWEG '' '' '' '@5B@' IW_VBAK-KUNNR. CLEAR: L_VKORGT,
L_VTWEGT,
L_VKORG,
L_VTWEG,
L_KUNNR,
IW_VBAK.
ENDLOOP. * 为TREE对象添加节点
SORT IT_NODETABLE BY NODE_KEY RELATKEY.
DELETE ADJACENT DUPLICATES FROM IT_NODETABLE COMPARING NODE_KEY RELATKEY. SORT IT_NODETABLE BY RELATSHIP ASCENDING ISFOLDER DESCENDING.
CALL METHOD WA_TREE->ADD_NODES
EXPORTING
TABLE_STRUCTURE_NAME = 'MTREESNODE'
NODE_TABLE = IT_NODETABLE
* EXCEPTIONS
* ERROR_IN_IT_NODETABLE = 1
* FAILED = 2
* DP_ERROR = 3
* TABLE_STRUCTURE_NAME_NOT_FOUND = 4
* others = 5
.
IF SY-SUBRC <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. PERFORM FRM_SET_ALVTB . *定义双击事件
EVENT1-EVENTID = CL_GUI_SIMPLE_TREE=>EVENTID_NODE_DOUBLE_CLICK.
EVENT1-APPL_EVENT = 'X'.
APPEND EVENT1 TO EVENTS. EVENT1-EVENTID = CL_GUI_SIMPLE_TREE=>EVENTID_NODE_CONTEXT_MENU_REQ.
EVENT1-APPL_EVENT = ''.
APPEND EVENT1 TO EVENTS. CALL METHOD WA_TREE->SET_CTX_MENU_SELECT_EVENT_APPL
EXPORTING
APPL_EVENT = 'X' . * 添加事件内表
CALL METHOD WA_TREE->SET_REGISTERED_EVENTS
EXPORTING
EVENTS = EVENTS
EXCEPTIONS
CNTL_ERROR =
CNTL_SYSTEM_ERROR =
ILLEGAL_EVENT_COMBINATION =
others =
.
IF SY-SUBRC <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. SET HANDLER G_APPLICATION->HANDLE_DOUBLE_CLICK FOR WA_ALVG.
SET HANDLER G_APPLICATION->HANDLE_HOTSPOT_CLICK FOR WA_ALVG.
SET HANDLER G_APPLICATION->HANDLE_TOOLBAR FOR WA_ALVG.
SET HANDLER G_APPLICATION->HANDLE_USER_COMMAND FOR WA_ALVG.
* 将已定义的双击事件分配到树对象
SET HANDLER G_APPLICATION->HANDLE_NODE_DOUBLE_CLICK FOR WA_TREE.
SET HANDLER G_APPLICATION->HANDLE_NODE_CONTEXT_MENU_REQ FOR WA_TREE.
SET HANDLER G_APPLICATION->HANDLE_NODE_CONTEXT_MENU_SEL FOR WA_TREE.
"为ALV设置toolbar
CALL METHOD WA_ALVG->SET_TOOLBAR_INTERACTIVE
. ENDFORM. " FRM_CREATE_TREE *&---------------------------------------------------------------------*
*& Form FRM_GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_NODE_KEY text
* -->P_IW_NODETABLE_RELATKEY text
*----------------------------------------------------------------------*
FORM FRM_GET_DATA USING P_KUNNR
P_VTWEG
P_VKORG. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = P_KUNNR
IMPORTING
OUTPUT = P_KUNNR. SELECT
VBAP~VBELN
VBAP~POSNR
VBAP~MATNR
VBAP~NETWR
VBAP~WERKS
VBAP~LSMENG
INTO TABLE IT_VBAP
FROM VBAP
INNER JOIN VBAK ON VBAP~VBELN = VBAK~VBELN
WHERE VBAK~VKORG = P_VKORG
AND VBAK~VTWEG = P_VTWEG
AND VBAK~KUNNR = P_KUNNR
AND VBAK~AUART NE 'Z001'.
IF IT_VBAP IS INITIAL.
MESSAGE S001() WITH '数据不存在或者尝试选择下级子节点'.
LEAVE TO SCREEN .
ENDIF. LOOP AT IT_VBAP INTO IW_VBAP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = IW_VBAP-VBELN
IMPORTING
OUTPUT = IW_VBAP-VBELN. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = IW_VBAP-MATNR
IMPORTING
OUTPUT = IW_VBAP-MATNR.
MODIFY IT_VBAP FROM IW_VBAP .
ENDLOOP. ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form FRM_GET_NODE_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FRM_GET_NODE_DATA . SELECT A~VKORG
A~VTWEG
A~KUNNR
A~VBELN
B~VTEXT
C~VTEXT
INTO TABLE IT_VBAK
FROM VBAK AS A
INNER JOIN TVKOT AS B ON B~VKORG = A~VKORG
INNER JOIN TVTWT AS C ON C~VTWEG = A~VTWEG
WHERE B~SPRAS = '' AND C~SPRAS = ''. SORT IT_VBAK BY VKORG VTWEG KUNNR VBELN.
DELETE ADJACENT DUPLICATES FROM IT_VBAK COMPARING VKORG VTWEG KUNNR. IF SY-SUBRC <> . ENDIF. LOOP AT IT_VBAK INTO IW_VBAK.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = IW_VBAK-KUNNR
IMPORTING
OUTPUT = IW_VBAK-KUNNR.
MODIFY IT_VBAK FROM IW_VBAK.
ENDLOOP. ENDFORM. " FRM_GET_NODE_DATA
*&---------------------------------------------------------------------*
*& Form FRM_SET_ALVTB
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FRM_SET_ALVTB .
DATA: IT_TB_EXCLUDE TYPE UI_FUNCTIONS,
IW_TB_EXCLUDE LIKE LINE OF IT_TB_EXCLUDE. CLEAR GW_FIELDCAT .
GW_FIELDCAT-FIELDNAME = 'VBELN' .
GW_FIELDCAT-SCRTEXT_L = '销售订单' .
GW_FIELDCAT-HOTSPOT = 'X'.
GW_FIELDCAT-KEY = 'X'.
APPEND GW_FIELDCAT TO GT_FIELDCAT . CLEAR GW_FIELDCAT .
GW_FIELDCAT-FIELDNAME = 'POSNR' .
GW_FIELDCAT-SCRTEXT_L = '销售订单项目' .
APPEND GW_FIELDCAT TO GT_FIELDCAT . CLEAR GW_FIELDCAT .
GW_FIELDCAT-FIELDNAME = 'MATNR' .
GW_FIELDCAT-SCRTEXT_L = '物料编码' .
APPEND GW_FIELDCAT TO GT_FIELDCAT . CLEAR GW_FIELDCAT .
GW_FIELDCAT-FIELDNAME = 'NETWR' .
GW_FIELDCAT-SCRTEXT_L = '净价' .
APPEND GW_FIELDCAT TO GT_FIELDCAT . CLEAR GW_FIELDCAT .
GW_FIELDCAT-FIELDNAME = 'WERKS' .
GW_FIELDCAT-SCRTEXT_L = '工厂' .
APPEND GW_FIELDCAT TO GT_FIELDCAT . CLEAR GW_FIELDCAT .
GW_FIELDCAT-FIELDNAME = 'LSMENG' .
GW_FIELDCAT-SCRTEXT_L = '销售订单数量' .
APPEND GW_FIELDCAT TO GT_FIELDCAT . GS_LAYOUT-GRID_TITLE = 'SD分销渠道销售订单数据' .
"GS_LAYOUT-CWIDTH_OPT = 'X' .
GS_LAYOUT-ZEBRA = 'X'. IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE.
IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE.
IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE.
IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE.
IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE.
IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE.
IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE.
IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE.
IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE.
IW_TB_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND IW_TB_EXCLUDE TO IT_TB_EXCLUDE. CALL METHOD WA_ALVG->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
* IS_PRINT =
* IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING = IT_TB_EXCLUDE
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = IT_VBAP
IT_FIELDCATALOG = GT_FIELDCAT
* IT_SORT =
* IT_FILTER =
* EXCEPTIONS
* INVALID_PARAMETER_COMBINATION = 1
* PROGRAM_ERROR = 2
* TOO_MANY_LINES = 3
* others = 4
.
IF SY-SUBRC <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. ENDFORM. " FRM_SET_ALVTB
*&---------------------------------------------------------------------*
*& Form FRM_DETAILS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LT_ROWS text
*----------------------------------------------------------------------*
FORM FRM_DETAILS TABLES P_LT_ROWS STRUCTURE LVC_S_ROW.
"插入正确名称 <...>.
DATA: L_INDEX TYPE LVC_INDEX.
DATA: IW_V1 LIKE LINE OF IT_VBAP. READ TABLE P_LT_ROWS INDEX .
IF SY-SUBRC = .
L_INDEX = P_LT_ROWS-INDEX.
CLEAR IW_V1.
READ TABLE IT_VBAP INDEX L_INDEX INTO IW_V1. SET PARAMETER ID: 'AUN' FIELD IW_V1-VBELN. CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDFORM. " FRM_DETAILS
*&---------------------------------------------------------------------*
*& Form FRM_HOTSPOT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_ROW_ID text
*----------------------------------------------------------------------*
FORM FRM_HOTSPOT USING P_E_ROW_ID.
DATA: L_INDEX TYPE LVC_INDEX.
DATA: IW_V1 LIKE LINE OF IT_VBAP.
L_INDEX = P_E_ROW_ID.
CLEAR IW_V1.
READ TABLE IT_VBAP INDEX L_INDEX INTO IW_V1. SET PARAMETER ID: 'AUN' FIELD IW_V1-VBELN. CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN. ENDFORM. " FRM_HOTSPOT
*&---------------------------------------------------------------------*
*& Form FRM_DBLCLICK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_ROW_ID text
*----------------------------------------------------------------------*
FORM FRM_DBLCLICK USING P_E_ROW.
DATA: L_INDEX TYPE LVC_INDEX.
DATA: IW_V2 LIKE LINE OF IT_VBAP.
L_INDEX = P_E_ROW.
CLEAR IW_V2.
READ TABLE IT_VBAP INDEX L_INDEX INTO IW_V2. SET PARAMETER ID: 'AUN' FIELD IW_V2-VBELN. CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDFORM. " FRM_DBLCLICK

实例:ABAP Tree Control 使用与ALV Grid对象关联的更多相关文章

  1. OO方式下,ALV TREE和ALV GRID的不同之处

    作为大部分报表程序的基础,ALV GRID差不多是每个ABAP开发者必须了解和掌握的内容,因此网上也不乏相关资料,而ALV TREE的应用相对较少,中文资料也就比较少见了.实际上,ALV TREE和A ...

  2. SAP Grid control( ALV Grid 列表 自定义 按钮)

    ALV 列表和按钮 效果 源代码 PROGRAM bcalvc_tb_menu_with_def_but. *&&&&&&&&& ...

  3. ME5xN(x:1-2): custom column is editable in Subscreen Item but not in ALV grid

    FM MEMFS_BUILD_MAPPING_PO_VIEWS->LMEMFSF0Z enhancement 14 zenhance_alvg_rid_editable. "activ ...

  4. VS2010/MFC编程入门之三十一(常用控件:树形控件Tree Control 下)

    前面一节讲了树形控件Tree Control的简介.通知消息以及相关数据结构,本节继续讲下半部分,包括树形控件的创建.CTreeCtrl类的主要成员函数和应用实例. 树形控件的创建 MFC为树形控件提 ...

  5. VS2010/MFC编程入门之三十(常用控件:树形控件Tree Control 上)

    前面两节为大家讲了列表视图控件List Control,这一节开始介绍一种特殊的列表--树形控件Tree Control. 树形控件简介 树形控件在Windows系统中是很常见的,例如资源管理器左侧的 ...

  6. VS2010-MFC(常用控件:树形控件Tree Control 下)

    转自:http://www.jizhuomi.com/software/203.html 前面一节讲了树形控件Tree Control的简介.通知消息以及相关数据结构,本节继续讲下半部分,包括树形控件 ...

  7. VS2010-MFC(常用控件:树形控件Tree Control 上)

    转自:http://www.jizhuomi.com/software/200.html 前面两节讲了列表视图控件List Control,这一节开始介绍一种特殊的列表--树形控件Tree Contr ...

  8. Visual studio C++ MFC之树形控件Tree Control

    背景 本篇旨在MSDN帮助文档下总结树形控件Tree Control的使用,并列出碰到的具体问题. 正文 树形控件Tree Control的类则是CTreeCtrl,具体成员对象详见链接,以下则描述一 ...

  9. 程序间获取ALV显示数据(读取ALV GRID上的数据)

    程序间获取ALV数据的两种方法: 方法1:通过修改SUBMIT的目标程序,把内表EXPORT到内存,SUBMIT后IMPORT ,该方法需要修改目标程序,可以任意设置目标程序的中断点: * Execu ...

随机推荐

  1. 分布式搜索Elasticsearch——QueryBuilders.matchPhrasePrefixQuery

    注:该文项目基础为分布式搜索Elasticsearch——项目过程(一)和分布式搜索Elasticsearch——项目过程(二),项目骨架可至这里下载. ES源代码中对matchPhrasePrefi ...

  2. foreman1.3安装

    一.环境: centos 6.3 64bit 二.安装yum源: rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release ...

  3. Android开发UI之textview实现高亮显示并点击跳转

    textview实现高亮显示,带下划线,带背景,主要是通过SpannableString类实现. 具体实现请看代码: TextView showMoreContent=(TextView)findvi ...

  4. pylinter could not automatically determined the path to `lint.py`

    先关闭Sublime Text 1) 到官网先下载pylinter,http://www.logilab.org/project/pylint,然后解压缩,拷贝到C盘,目录为C:\pylint-1.0 ...

  5. Angularjs checkbox的ng属性

    angularjs 默认给 input[checkbox] 元素定制了一些属性,如: <input type="checkbox" ng-mudel="name&q ...

  6. mysql 查看表的类型

    MySQL 数据表主要支持六种类型 ,分别是:BDB.HEAP.ISAM.MERGE.MYISAM.InnoBDB. 这六种又分为两类,一类是”事务安全型”(transaction-safe),包括B ...

  7. [CF 471C] MUH and House of Cards

    C. MUH and House of Cards   Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elep ...

  8. 导出Excel帮助类

    using System; using System.Collections.Generic; using System.Text; using System.Data; using System.D ...

  9. 017QTP 描述性编程的使用方法

    一.什么时候使用描述性编程 在测试过程中,有些界面元素是动态出现或动态变化的,在录制的时候并没有添加到对象库中 二.描述性编程的运行原理 用描述性编程编写的测试脚本在运行时,QTP会使用测试脚本中给出 ...

  10. 【原】Redis分区

    Redis高级篇 分区 为什么分区? Redis中的分区主要有两个目的: 允许用多台机器的内存存放更大的数据集.如果没有分区,那么你只能存放单台机器内存的最大值的数据集. 允许用多核和多台机器提高计算 ...