![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
I've cracked it. I didn't look closely enough at what happens after the first call to Findfolders. First time parameter "node" is a TreeView, other times it is a Node. You need a conditional test to find out which. Note the type name of a Node as returned by ControlType is "Treeview.Node". You may need to try with a msgbox to see what is returned for other external controls.
Code:
Sub FindFolders (path, node) 'Finds all folders in a specific path WaitCursor(true) al1.clear DirSearch(al1,path) c = StrLength(path) For I =0 To al1.count - 1 s=al1.item(i) If ControlType(node) = "TreeView.Node" Then Control(node, node).addnewnode (SubString(s,c,StrLength(s)-c)) Else Control(node, treeview).addnewnode (SubString(s,c,StrLength(s)-c)) End If Next al1.Clear FileSearch(al1,path) For I =0 To al1.count - 1 s=al1.item(i) If ControlType(node) = "TreeView.Node" Then node2.Value = Control(node,node).addnewnode (SubString(s,c,StrLength(s)-c)) Else node2.Value = Control(node,treeview).addnewnode (SubString(s,c,StrLength(s)-c)) End If node2.ImageIndex = 2 node2.SelectedImageIndex = 2 Next If ControlType(node) = "TreeView.Node" Then Control(node,node).expandall Else Control(node,treeview).expandall End If WaitCursor(false) End Sub |
|
|||
|
@ specci48
I tried changing the compiler like you mentioned, and I got it working ( the original file) So I incorporated that in my program and it worked! the only drawback is that the (or a) sub "remembers" the last folder opened and if used again it will not read the new folder that is clicked, so i cannot re-use the code to open another file, I think it probably has to do with the naming issue agraham found. I already tried to set most of the variables to "" but that didn't work...so thats next on my list :-) @agraham great job, I'll try your version next, the compiled file is pretty big compared to the optimized version @RandomCoder Sure i'll try anything to get it working, I'm actually losing sleep over this ;-) Last night I thought of making a standalone version of the folderchooser program, this could then write the location to an temp file and my program could then read it when it gets focus... Thank you all for your help on this, I'll let you know if it works |
|
||||
|
I've updated the extended FolderChooser example to support the optimized compiler:
http://www.basic4ppc.com/forum/showthread.php?p=2871 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Specified cast is not valid | bish0p | Questions & Help Needed | 1 | 07-11-2008 08:17 PM |
| identifying a node in treeview | BjornF | Questions & Help Needed | 3 | 05-29-2008 05:47 PM |
| Specified cast is not valid | skipper | Questions & Help Needed | 7 | 03-12-2008 08:17 AM |
| Object Reference not set to an instance of an object | monster9999 | Questions & Help Needed | 9 | 01-15-2008 10:56 PM |
| treeview color (node) | tvrman | Questions & Help Needed | 2 | 08-04-2007 06:57 PM |