Home » Developer & Programmer » Forms » Treeview menu (Windows 7 Forms 6i)
|
Re: Treeview menu [message #604330 is a reply to message #604329] |
Sat, 28 December 2013 14:19 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/1229663c86eb1a441385fe710cd9116e?s=64&d=mm&r=g) |
mughals_king
Messages: 392 Registered: January 2012 Location: pakistan
|
Senior Member |
|
|
Yes you can acomplish this task easily follow THESE below steps.
Create table and insert data like below
S_NUM NAME MENU_NAME
01 Point of Sale
02 Sales Section
0101 Sales Receipt SALES RECEIPT
0102 Sales Return Receipt SALES RETURN
0103 Add New Customer ADD CUSTOMER
0104 Customer List CUSTOMER LIST
03 Reports
0301 Sales Report
0302 Sales Return
0303 Sales Reports
0304 Customer Detail
0305 Customer List
--------------------------
WHEN-NEW-FORM-INSTANCE------TRIGGER
----------------------------
DECLARE
htree ITEM;
top_node FTREE.NODE ;
new_node FTREE.NODE ;
child_node FTREE.NODE ;
child_node1 FTREE.NODE ;
item_value VARCHAR2(30);
cursor prime_cur is
SELECT S_NUM,NAME FROM MENU WHERE LENGTH (S_NUM) = 2 ;
cursor child_cur(T varchar2) is
SELECT S_NUM ,NAME FROM MENU WHERE LENGTH(S_NUM)=4 AND SUBSTR(S_NUM,1,2)=T;
cursor child_cur1(t1 varchar2) is
SELECT S_NUM,NAME FROM MENU WHERE LENGTH(S_NUM)=6 AND SUBSTR(S_NUM,1,4)=t1;
BEGIN
htree := Find_Item('BLOCK.tree_item');
for dummy in prime_cur
loop
new_node := Ftree.Add_Tree_Node
(htree,ftree.root_node,
Ftree.PARENT_OFFSET,
Ftree.LAST_CHILD,
Ftree.EXPANDED_NODE,
dummy.name,
'c:\ICONS\a',
dummy.S_NUM);
for child in child_cur(dummy.S_NUM) loop
child_node := Ftree.Add_Tree_Node
(htree,new_node,
Ftree.PARENT_OFFSET,
Ftree.LAST_CHILD,
Ftree.EXPANDED_NODE,
child.name,
'D:\ICONS\GO',child.S_NUM);
for child1 in child_cur1(child.S_NUM) loop
child_node1 := Ftree.Add_Tree_Node
(htree,CHILD_NODE,
Ftree.PARENT_OFFSET,
Ftree.LAST_CHILD,
Ftree.EXPANDED_NODE,
child1.name,'D:\ICONS\GO',child1.S_NUM);
end loop;
end loop;
end loop;
exception when others then
message(sqlerrm(sqlcode));
END;
-----------------------------------
WHEN-TREE-NODE-EXPANDED-----TRIGGER
NULL;
WHEN-TREE-NODE-ACTIVATED-----TRIGGER
NULL;
WHEN-TREE-NODE-SELECTED----TRIGGER
------------------------------------
if :SYSTEM.TRIGGER_NODE_SELECTED in('TRUE') then
DECLARE
a varchar2(100);
b varchar2(100);
htree ITEM;
node_value VARCHAR2(100);
BEGIN
htree := Find_Item('BLOCK.tree_item');
node_value :=Ftree.Get_Tree_Node_Property
(htree, :SYSTEM.TRIGGER_NODE,
Ftree.NODE_VALUE);
if substr(node_value,1,2) in('01','02') then
select nvl(MENU_NAME,'tt')into a from menu where s_num=node_value;
if a='tt' then
CALL_FORM('c:\forms'||a||'.FMX', switch_menu => do_replace);
end if;
elsif substr(node_value,1,2) in('03') then
select nvl(menu_name,'rr')into b from menu where s_num=node_value;
if b='rr' then
Run_Product(REPORTS, 'c:\'||b||'.rep', ASYNCHRONOUS, RUNTIME, FILESYSTEM, 'A', NULL);
end if;
elsif substr(node_value,1,2) in('04') then
exit_form;
end if;
end;
elsif :SYSTEM.TRIGGER_NODE_SELECTED in('FALSE') then
null;
end if;
Regard
Mughal
[Updated on: Sat, 28 December 2013 14:24] Report message to a moderator
|
|
|
|
Re: Treeview menu [message #604341 is a reply to message #604339] |
Sun, 29 December 2013 00:53 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
shahzad-ul-hasan
Messages: 625 Registered: August 2002
|
Senior Member |
|
|
Create a Trigger at form level:
When_new_form_instace....
then at tree(item level put this code).
WHEN-TREE-NODE-SELECTED----TRIGGER
------------------------------------
if :SYSTEM.TRIGGER_NODE_SELECTED in('TRUE') then
DECLARE
a varchar2(100);
b varchar2(100);
htree ITEM;
node_value VARCHAR2(100);
BEGIN
htree := Find_Item('BLOCK.tree_item');
node_value :=Ftree.Get_Tree_Node_Property
(htree, :SYSTEM.TRIGGER_NODE,
Ftree.NODE_VALUE);
if substr(node_value,1,2) in('01','02') then
select nvl(MENU_NAME,'tt')into a from menu where s_num=node_value;
if a='tt' then
CALL_FORM('c:\forms'||a||'.FMX', switch_menu => do_replace);
end if;
elsif substr(node_value,1,2) in('03') then
select nvl(menu_name,'rr')into b from menu where s_num=node_value;
if b='rr' then
Run_Product(REPORTS, 'c:\'||b||'.rep', ASYNCHRONOUS, RUNTIME, FILESYSTEM, 'A', NULL);
end if;
elsif substr(node_value,1,2) in('04') then
exit_form;
end if;
end;
elsif :SYSTEM.TRIGGER_NODE_SELECTED in('FALSE') then
null;
end if;
|
|
|
|
|
|
|
|
|
|
|
|
Re: Treeview menu [message #604552 is a reply to message #604540] |
Wed, 01 January 2014 01:56 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
@lock_heart asked a question (whether you created that table (MENU) in a schema you are connected to when working with Forms), but you still didn't answer it. Would you mind?
|
|
|
Goto Forum:
Current Time: Fri Aug 23 19:46:26 CDT 2024
|