on 07-18-2005 11:52 AM
Hi,
Is there any event being raising when a node is expanded?? I need it in order to generate tree at run time while the user is expanding the nodes.
<i>P.S.
WAS 6.20</i>
If you are talking about CL_GUI_ALV_TREE, no there no event when you click on the expander on the left hand side? However, if you want to expand if you double click on the NODE you will have to write code for NODE_DOUBLE_CLICK event.
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok... but if I implement the NODE_DOUBLE_CLICK handler, there will be no reaction on clicking on the node expand button (a small triangle from the left of the node icon). Then it will be ambiguous if there are the two ways of the node expanding and only is right. In other word the user will have to use only double click for expanding nodes in proper way.
Nevertheless, thanks for the information. I will be looking for the solution.
as i said before you need to register the event
<b>EXPAND_NC</b>
for you to be able to achieve node expand in <b>ALV Tree</b>
Regards
Raja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In PBO,
form create.
if o_tree is initial.
create object o_tree
exporting
LIFETIME =
parent = pparent
SHELLSTYLE =
node_selection_mode = o_tree->node_sel_mode_single
HIDE_SELECTION =
NAME =
exceptions
lifetime_error = 1
cntl_system_error = 2
create_error = 3
failed = 4
illegal_node_selection_mode = 5
others = 6.
perform f9800_error_handle using text-E06.
endif.
form f9100_create_tree using p_o_tree type ref to cl_gui_simple_tree.
refresh: i_nodes.
clear: w_nodes.
Header Tree Folder
w_nodes-node_key = 'ROOT'.
w_nodes-isfolder = c_x.
w_nodes-expander = c_x.
w_nodes-text = text-009.
append w_nodes to i_nodes.
Adding Root Nodes for the tree.
Key:
NODE_KEY, RELATKEY, RELATSHIP, HIDDEN, DISABLED, ISFOLDER, N_IMAGE,
EXP_IMAGE, STYLE, LAST_HITEM, NO_BRANCH, EXPANDER, DRAGDROPID, TEXT
perform f9101_node_list using: '1' 'ROOT' '' '' '' c_x '' '' '' '' ''
c_x '' text-003.
Adding subitems for the root node.
perform f9101_node_list using:
Material Details
'MATRL' '1' '' '' '' '' '' '' '' '' '' '' ''
text-001,
Document Details
'DOCU' '1' '' '' '' '' '' '' '' '' '' '' ''
text-002.
add the nodes to the tree object,
perform f9102_add_treenodes tables i_nodes
using 'ABDEMONODE' "node definition
p_o_tree. "tree declaration
enabling event handlers for the tree
perform f9103_tree_event_handle using p_o_tree.
endform. " f9100_create_tree
&----
*& Form f9101_node_list
&----
Adding Nodes in a TREE
----
form f9101_node_list using value(pnodekey)
value(prelatkey)
value(prelatship)
value(phidden)
value(pdisabled)
value(pisfolder)
value(pimage)
value(pexpimage)
value(pstyle)
value(plastitem)
value(pnobranch)
value(pexpander)
value(pdragdropid)
value(ptext).
w_nodes-node_key = pnodekey.
w_nodes-relatkey = prelatkey.
w_nodes-relatship = prelatship. "Natural number
w_nodes-hidden = phidden.
w_nodes-disabled = pdisabled.
w_nodes-isfolder = pisfolder.
w_nodes-n_image = pimage. "Icons / embedded bitmap
w_nodes-exp_image = pexpimage. "Icons / embedded bitmap
w_nodes-style = pstyle.
w_nodes-last_hitem = plastitem. "Tree Control: Column Name / Item
"Name
w_nodes-no_branch = pnobranch.
w_nodes-expander = pexpander.
w_nodes-dragdropid = pdragdropid.
w_nodes-text = ptext.
append w_nodes to i_nodes.
endform. " f9101_node_list
&----
*& Form f9102_add_treenodes
&----
Adding the Nodes to the Tree
----
-->PI_NODES Table containg the Nodes
-->PTABLE Name of the Table structure name
-->PO_TREE tree object
----
form f9102_add_treenodes tables pi_nodes type standard table
using value(ptable)
po_tree type ref to cl_gui_simple_tree.
call method po_tree->add_nodes
exporting
table_structure_name = ptable "may need to change
node_table = pi_nodes[]
exceptions
error_in_node_table = 1
failed = 2
dp_error = 3
table_structure_name_not_found = 4
others = 5
.
perform f9800_error_handle using text-E10.
endform. " f9102_add_treenodes
&----
*& Form f9103_tree_event_handle
&----
Event Handling for Tree.
----
-->P_P_O_TREE text
----
form f9103_tree_event_handle using
p_o_tree type ref to cl_gui_simple_tree.
w_tree_event-eventid = <b>cl_gui_simple_tree=>eventid_node_double_click.</b> w_tree_event-appl_event = ' '. " process PAI if event occurs
append w_tree_event to i_tree_event.
call method <b>p_o_tree->set_registered_events</b>
exporting
events = i_tree_event
exceptions
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
if sy-subrc <> 0.
MESSAGE A000.
endif.
if o_eventreceiver is initial.
create object o_eventreceiver.
endif.
<b>
set handler o_eventreceiver->handle_node_double_click for p_o_tree.</b>
endform. " f9103_tree_event_handle
Try this one.
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
while u add the nodes for a tree, u have the option for having an expander:
Adding Root Nodes for the tree.
Key:
NODE_KEY, RELATKEY, RELATSHIP, HIDDEN, DISABLED, ISFOLDER, N_IMAGE,
EXP_IMAGE, STYLE, LAST_HITEM, NO_BRANCH, <b>EXPANDER</b>, DRAGDROPID, TEXT
PERFORM f9101_node_list USING: '1' 'ROOT' '' '' '' c_x '' '' '' '' ''
c_x '' 'Order'.
FORM f9101_node_list USING value(pnodekey)
value(prelatkey)
value(prelatship)
value(phidden)
value(pdisabled)
value(pisfolder)
value(pimage)
value(pexpimage)
value(pstyle)
value(plastitem)
value(pnobranch)
value(pexpander)
value(pdragdropid)
value(ptext).
w_nodes-node_key = pnodekey.
w_nodes-relatkey = prelatkey.
w_nodes-relatship = prelatship. "Natural number
w_nodes-hidden = phidden.
w_nodes-disabled = pdisabled.
w_nodes-isfolder = pisfolder.
w_nodes-n_image = pimage. "Icons / embedded bitmap
w_nodes-exp_image = pexpimage. "Icons / embedded bitmap
w_nodes-style = pstyle.
w_nodes-last_hitem = plastitem. "Tree Control: Column Name / Item
"Name
w_nodes-no_branch = pnobranch.
w_nodes-expander = pexpander.
w_nodes-dragdropid = pdragdropid.
w_nodes-text = ptext.
APPEND w_nodes TO i_nodes.
ENDFORM. " f9101_node_list
The way u attach the nodes to the root node, will b automatically called when u expand a node, and there is no need for raising any events for the same.
So care is needed only while attaching a nodes to the tree.
Regards,
Anjali.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.