ravl
asked on
How to Use ActiveX Treeview Control in Frontpage98
Can anyone give me an example of how to use the Treeview control?
Alternatively, can you point me to some literature which will explain how to use it?
I simply want to use it to display a fixed list of topics which are expandable to sub-topics. The latter will link to various URLs in our intranet.
Alternatively, can you point me to some literature which will explain how to use it?
I simply want to use it to display a fixed list of topics which are expandable to sub-topics. The latter will link to various URLs in our intranet.
I've added some code for the navigation. Drop me a line if you need further explanations.
<HTML>
<HEAD>
<TITLE>New Page</TITLE>
</HEAD>
<BODY>
<OBJECT ID="TreeView1"
TYPE="application/x-oleobj ect"
CLASSID="CLSID:0713E8A2-85 0A-101B-AF C0-4210102 A8DA7"
CODEBASE="/scripts/comctl3 2.ocx"
WIDTH=100% HEIGHT=82% >
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad()
Dim nodX, nodRoot
TreeView1.LineStyle=1
Set nodRoot = TreeView1.Nodes.Add(,, "r", "Links")
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.experts-exchange.com", "Experts Exchange")
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.microsoft.com", "Microsoft")
End Sub
Sub Treeview1_DblClick
On Error Resume Next
If TreeView1.SelectedItem.Ind ex > 1 Then
If Err.Number = 0 Then
Navigate TreeView1.SelectedItem.Key
End If
End If
End Sub
-->
</SCRIPT>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>New Page</TITLE>
</HEAD>
<BODY>
<OBJECT ID="TreeView1"
TYPE="application/x-oleobj
CLASSID="CLSID:0713E8A2-85
CODEBASE="/scripts/comctl3
WIDTH=100% HEIGHT=82% >
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad()
Dim nodX, nodRoot
TreeView1.LineStyle=1
Set nodRoot = TreeView1.Nodes.Add(,, "r", "Links")
Set nodX = TreeView1.Nodes.Add(nodRoo
Set nodX = TreeView1.Nodes.Add(nodRoo
End Sub
Sub Treeview1_DblClick
On Error Resume Next
If TreeView1.SelectedItem.Ind
If Err.Number = 0 Then
Navigate TreeView1.SelectedItem.Key
End If
End If
End Sub
-->
</SCRIPT>
</BODY>
</HTML>
ASKER
Thank you for that answer brice123. I get the idea. Just one thing - I can get it to work in FP98 with both Treeview controls (5.0,SP2 and 6.0) using IE5, but it doesn't work in FP98 (5.0, SP2) using IE4.0. The error is "object doesn't support this object or method - Treeview1.Linestyle".
ASKER
Sorry - in my previous comment "FP98 with both Treeview controls (5.0,SP2 and 6.0) using IE5" read "FP2K with both Treeview controls (5.0,SP2 and 6.0) using IE5"
ASKER
Further - in the 2nd example (navigation), the tree doesn't load in Window_Onload event. The code works if I move it to the Button1_OnClick event.
Strange, the second sample seems to work fine with IE5 and the Treeview Control 5.0 SP2.
Which version of vbscript.dll are you using? (5.0.0.3715?)
Which version of vbscript.dll are you using? (5.0.0.3715?)
ASKER
OK - everything works with FP2K and IE5. Don't know what went wrong the first time. However, I can't get it to work with FP98 and IE4 which is where I need it. The error is "object doesn't support this object or method - Treeview1.Linestyle". The vbscript version here is 3.1.0.2414.
OK, I will try it tonight on IE4. What happens if you remove that line? Do you get further errors messages or not?
ASKER
If I remove the line I get the same error on the next line. It doesn't seem to recognise the methods for the object.
Maybe try to add a NAME argument behind the OBJECT tag :
<object id="Treeview1" name="Treeview1" ...
<object id="Treeview1" name="Treeview1" ...
The following sample works fine with IE4. Unfortunately, FP98 was not available on my test PC; so I used FP Express and the ActiveX Notepad tool for setting-up the control properties (linestyle, font, etc.).
For the test, I also placed an ImageList control containing two icons.
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title></title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<script language="VBScript">
<!--
Sub window_onLoad()
Dim nodX, nodRoot
Set Treeview1.ImageList = ImageList1
Set nodRoot = Treeview1.Nodes.Add(,, "r", "Links",1,2)
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.experts-exchange.com", "Experts Exchange",1,2)
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.microsoft.com", "Microsoft",1,2)
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.apple.com", "Apple",1,2)
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.sun.com", "Sun Microsystems",1,2)
End Sub
-->
</script><object id="ImageList1"
data="DATA:application/x-o leobject;B ASE64,j43a WGqdGxCvwE IQECqNpyFD NBIIAAAA7Q MAAO0DAACQ jdpYAAAFAC IAAAAQABAA wMDAAP//AA AB782rAAAF AKDuaAAGAA AA/////wUA AIAAAAAAAg AAAAAAAgAA AAEAAABsdA AAQAEAAAAA AQABABAQEA AAAAAAKAEA ABYAAAAoAA AAEAAAACAA AAABAAQAAA AAAMAAAAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAgA AAgAAAAICA AIAAAACAAI AAgIAAAMDA wACAgIAAAA D/AAD/AAAA //8A/wAAAP 8A/wD//wAA ////AAAAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAO/ v7+/v7+wA/ v7+/v7+/AD /7+/v7+/sA P7+/v7+/vw A/+/v7+/v7 AD+/v7+/v7 8AP/v7+/v7 +wA/v7+/v7 +/AD////// //sAP7+/vz MzMwAD//vz AAAAAAAzMz AAAAAAAAAA AAAAAA//8A AP//AADAAA AAgAAAAIAA AACAAAAAgA AAAIAAAACA AAAAgAAAAI AAAACAAAAA gAEAAMA/AA DgfwAA//8A AAAAAgAAAG x0AABAAQAA AAABAAEAEB AQAAAAAAAo AQAAFgAAAC gAAAAQAAAA IAAAAAEABA AAAAAAwAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA CAAACAAAAA gIAAgAAAAI AAgACAgAAA wMDAAICAgA AAAP8AAP8A AAD//wD/AA AA/wD/AP// AAD///8AAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA ADMzMzMzMw AAP/v7+/vz AAP/v7+/v7 AwA/v7+/v7 MDA/v7+/v7 8PsD/7+/v7 +wvwMzMzMz Mzv7AD+/v7 +/v78AP/v7 +///+wA/v7 +/MzMzAAP/ //MAAAAAAD MzMAAAAAAA AAAAAAAAD/ /wAA//8AAO AAAADAAAAA wAAAAIAAAA CAAAAAAAAA AAAAAAAAAA AAgAAAAIAA AACAAQAAwH 8AAOD/AAD/ /wAAAAAAAA =="
classid="CLSID:58DA8D8F-9D 6A-101B-AF C0-4210102 A8DA7"
align="baseline" border="0" width="39" height="39"></object>
<p><script language="VBScript">
<!--
Sub Treeview1_DblClick()
On Error Resume Next
If Treeview1.SelectedItem.Ind ex > 1 Then
If Err.Number = 0 Then
Navigate Treeview1.SelectedItem.Key
End If
End If
End Sub
-->
</script> <object id="Treeview1"
name="Treeview1"
data="DATA:application/x-o leobject;B ASE64,ougT BwqFGxCvwE IQECqNpyFD NBIIAAAAJS AAAMUaAACj 6BMHAAAFAC IAAAC91gCq wgIAAAEAAA AB782rAAAF AHKn8WUGAA AAEgAAgAUA AIC87mgAAQ AAAFwAH97s vQAABQDRTU gAAQAAAJAB REIBAA1NUy BTYW5zIFNl cmlmSAA="
classid="CLSID:0713E8A2-85 0A-101B-AF C0-4210102 A8DA7"
align="baseline" border="0" width="250" height="300"></object> </p>
</body>
</html>
For the test, I also placed an ImageList control containing two icons.
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title></title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<script language="VBScript">
<!--
Sub window_onLoad()
Dim nodX, nodRoot
Set Treeview1.ImageList = ImageList1
Set nodRoot = Treeview1.Nodes.Add(,, "r", "Links",1,2)
Set nodX = TreeView1.Nodes.Add(nodRoo
Set nodX = TreeView1.Nodes.Add(nodRoo
Set nodX = TreeView1.Nodes.Add(nodRoo
Set nodX = TreeView1.Nodes.Add(nodRoo
End Sub
-->
</script><object id="ImageList1"
data="DATA:application/x-o
classid="CLSID:58DA8D8F-9D
align="baseline" border="0" width="39" height="39"></object>
<p><script language="VBScript">
<!--
Sub Treeview1_DblClick()
On Error Resume Next
If Treeview1.SelectedItem.Ind
If Err.Number = 0 Then
Navigate Treeview1.SelectedItem.Key
End If
End If
End Sub
-->
</script> <object id="Treeview1"
name="Treeview1"
data="DATA:application/x-o
classid="CLSID:0713E8A2-85
align="baseline" border="0" width="250" height="300"></object> </p>
</body>
</html>
Oops, sorry for the width of my text...
This one is more readable:
<html>
<head>
<title></title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<script language="VBScript">
<!--
Sub window_onLoad()
Dim nodX, nodRoot
Set nodRoot = Treeview1.Nodes.Add(,, "r", "Links")
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.experts-exchange.com", "Experts Exchange")
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.microsoft.com", "Microsoft")
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.apple.com", "Apple")
Set nodX = TreeView1.Nodes.Add(nodRoo t.Index, 4, "http:\\www.sun.com", "Sun Microsystems")
End Sub
-->
</script>
<p><script language="VBScript">
<!--
Sub Treeview1_DblClick()
On Error Resume Next
If Treeview1.SelectedItem.Ind ex > 1 Then
If Err.Number = 0 Then
Navigate Treeview1.SelectedItem.Key
End If
End If
End Sub
-->
</script> <object id="Treeview1"
name="Treeview1"
data="DATA:application/x-o leobject;B ASE64,ougT BwqFGxCvwE IQECqNpyFD NBIIAAAAJS AAAMUaAACj 6BMHAAAFAC IAAAC91gCq wgIAAAEAAA AB782rAAAF AHKn8WUGAA AAEgAAgAUA AIC87mgAAQ AAAFwAH97s vQAABQDRTU gAAQAAAJAB REIBAA1NUy BTYW5zIFNl cmlmSAA="
classid="CLSID:0713E8A2-85 0A-101B-AF C0-4210102 A8DA7"
align="baseline" border="0" width="250" height="300"></object> </p>
</body>
</html>
This one is more readable:
<html>
<head>
<title></title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<script language="VBScript">
<!--
Sub window_onLoad()
Dim nodX, nodRoot
Set nodRoot = Treeview1.Nodes.Add(,, "r", "Links")
Set nodX = TreeView1.Nodes.Add(nodRoo
Set nodX = TreeView1.Nodes.Add(nodRoo
Set nodX = TreeView1.Nodes.Add(nodRoo
Set nodX = TreeView1.Nodes.Add(nodRoo
End Sub
-->
</script>
<p><script language="VBScript">
<!--
Sub Treeview1_DblClick()
On Error Resume Next
If Treeview1.SelectedItem.Ind
If Err.Number = 0 Then
Navigate Treeview1.SelectedItem.Key
End If
End If
End Sub
-->
</script> <object id="Treeview1"
name="Treeview1"
data="DATA:application/x-o
classid="CLSID:0713E8A2-85
align="baseline" border="0" width="250" height="300"></object> </p>
</body>
</html>
ASKER
Again, it works fine with FP200/IE5 but not with FP98/IE4!!!
I won't ask you to try to solve that environment problem. You've provided me with a very good answer and I thank you for your time on this. It has been a great help. As a site we'll be moving to IE5 shortly and so hopefully I'll be right then.
This is the first time I've used this facility - do I have to do something to close this off?
I won't ask you to try to solve that environment problem. You've provided me with a very good answer and I thank you for your time on this. It has been a great help. As a site we'll be moving to IE5 shortly and so hopefully I'll be right then.
This is the first time I've used this facility - do I have to do something to close this off?
Just accept this answer message if you want to give me the points.
Thanks in advance.
A last word: maybe you should use a Java applet in place of an ActiveX control for a better browser compatibility.
http://www.javaside.com/j_tliste.html
http://www.devdaily.com/java/applets/URLTree/
http://javaboutique.internet.com/TreeView/
Thanks in advance.
A last word: maybe you should use a Java applet in place of an ActiveX control for a better browser compatibility.
http://www.javaside.com/j_tliste.html
http://www.devdaily.com/java/applets/URLTree/
http://javaboutique.internet.com/TreeView/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks again.
<HEAD>
<TITLE>New Page</TITLE>
</HEAD>
<BODY>
<OBJECT ID="TreeView1"
TYPE="application/x-oleobj
CLASSID="CLSID:0713E8A2-85
CODEBASE="/scripts/comctl3
WIDTH=100% HEIGHT=82% >
</OBJECT>
<FORM><INPUT NAME="Button1" TYPE="BUTTON" VALUE="Click Here"></FORM>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Button1_OnClick()
Dim nodX, imgX
TreeView1.LineStyle=1
Set nodX = TreeView1.Nodes.Add(,, "r", "Root")
Set nodX = TreeView1.Nodes.Add(nodX.I
Set nodX = TreeView1.Nodes.Add(nodX.I
end sub
-->
</SCRIPT>
</BODY>
</HTML>