Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TreeView Control please help!

Status
Not open for further replies.

Pherl

Programmer
Feb 22, 2002
5
0
0
US
Hi there, I have managed to get a treeview ctl to work on my HTA but cant figure out how to trap an ExpandNode event!

Code:
sub dirView_NodeClick(whatnode)
	output = whatnode.Key
	statusline.innerHTML = output
end sub

the above code works fine, however, when I try the same technique with any other event, it does absolutely nothing! Why is that? For example:

Code:
sub dirView_ExpandNode(lalala)
	msgBox "Node Expanded"
end sub

Does absolutely nothing!

BTW, Im using the MSForms TreeView 6.0 control

Any help would be greatly appreciated!
 
The event is named Expand, Node is the parameter:
Code:
<HTML>
<HEAD>
<HTA:APPLICATION />
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE></TITLE>
<SCRIPT LANGUAGE=&quot;VBScript&quot;>
Const tvwChild = 4

Sub TreeView1_Expand(objNode)
	MsgBox &quot;Here!&quot;
End Sub

Sub button1_onclick()
	TreeView1.Nodes.Add , , &quot;k1&quot;, &quot;Stuff 1&quot;
	TreeView1.Nodes.Add &quot;k1&quot;, tvwChild, &quot;k11&quot;, &quot;Stuff 1 1&quot;
	TreeView1.Nodes.Add &quot;k1&quot;, tvwChild, &quot;k12&quot;, &quot;Stuff 1 2&quot;
	TreeView1.Nodes.Add &quot;k1&quot;, tvwChild, &quot;k13&quot;, &quot;Stuff 1 3&quot;
End Sub
</SCRIPT>
</HEAD>
<BODY>

<P>
<OBJECT id=TreeView1 style=&quot;WIDTH: 220px; HEIGHT: 249px&quot; 
classid=clsid:C74190B6-8589-11D1-B16A-00C0F0283628 VIEWASTEXT>
<PARAM NAME=&quot;_ExtentX&quot; VALUE=&quot;5821&quot;>
<PARAM NAME=&quot;_ExtentY&quot; VALUE=&quot;6588&quot;>
<PARAM NAME=&quot;_Version&quot; VALUE=&quot;393217&quot;>
<PARAM NAME=&quot;HideSelection&quot; VALUE=&quot;1&quot;>
<PARAM NAME=&quot;Indentation&quot; VALUE=&quot;1000&quot;>
<PARAM NAME=&quot;LabelEdit&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;LineStyle&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;PathSeparator&quot; VALUE=&quot;\&quot;>
<PARAM NAME=&quot;Sorted&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;Style&quot; VALUE=&quot;7&quot;>
<PARAM NAME=&quot;Checkboxes&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;FullRowSelect&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;HotTracking&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;Scroll&quot; VALUE=&quot;1&quot;>
<PARAM NAME=&quot;SingleSel&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;ImageList&quot; VALUE=&quot;&quot;>
<PARAM NAME=&quot;BorderStyle&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;Appearance&quot; VALUE=&quot;1&quot;>
<PARAM NAME=&quot;MousePointer&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;Enabled&quot; VALUE=&quot;1&quot;>
<PARAM NAME=&quot;OLEDragMode&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;OLEDropMode&quot; VALUE=&quot;0&quot;>
</OBJECT>
</P>
<P><INPUT type=button value=Button id=button1 name=button1></P>
</BODY>
</HTML>
This HTA works fine.
 
My first clue was the InterDev Object Bowser, then I just consulted the VB6 Help in MSDN Libay.

Hope it helps!
 
WoW! Thank you so VERY much!

While I have no idea what the interDev Object Browser is, nor could I find any helpful reference about the vb6 treeview control on the MSDN website, I am very thankful for your help! :) It works perfectly. Insanity: Doing the same thing over and over again and expecting different results. -Albert Einstein
 
I'm sorry if I was misleading...

I was referring to the MSDN Libray (on CD/DVD) and the VB6 documentation contained within that is part of the Visual Studio toolkit.

This info is available online, but you need to know how to dig though the MSDN Libray (or get darned lucky on a search). The control you are using is not really meant for web development, it is intended as a VB control. But it works just fine in an HTA!

See:


This is the head reference for TreeView 6.0



The Object Browser is a very handy applet that functions within the IDEs (VB and InterDev) provided by Visual Studio. It lets you &quot;peek inside&quot; of object library files (.TLBs, .DLLs, .OCXs, etc.) and see the actual object model. It reveals the objects, methods, propeties, events, and constants within the library. It gives method parameter lists and everything - very useful.

I think even VB5 has an Object Browser.

One thing I must seriously recommend to anybody who doesn't have Visual Studio or at leaast VB, and who wants to use VBScript for any purpose - desktop, server, or client - is to get your hands on VB 5 CCE (Control Creation Edition).

VB5CCE is FREE, is perfectly usable, and lets you build custom controls as well as explore pre-built ones. In some cases you may need to use a control from VBScript but you run into a problem with data types - script usually only handles Variants correctly. VB5CCE will let you &quot;wrap&quot; a control that script can't use directly with a type-matcher-upper that exposes a Variants-only interface to script and passes strong types to the pre-built jobbie-doo.

VB5CCE is really VB5 without the ability to save a compiled EXE (though it can save OCXs and such), some missing sets of MS controls, and shabby docs. That's the weakest part of VB5CCE - the docs (online Help).

You need to root around to find all the VB5 docs you will need as separate downloads.

Start here:


As an HTA developer you should be really jazzed about this. Remember I said you can't make an EXE with VB5CCE?

Well you can write practically a whole VB program as an OCX with one or more &quot;UserControls&quot; instead of VB forms, then invoke these together from your HTA which becomes the host for them. The HTA can be as fancy or as skeletal as you please.

Voila! Free VB development. {Please don't tell MS, anybody ;-)}
 
Whoa! And yes, Im verry jazzed! Thank you so much for all your help! Downloading vbcce as we speak and cant wait! Insanity: Doing the same thing over and over again and expecting different results. -Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top