The Daily Click ::. Forums ::. Klik Coding Help ::. Tree Contrrol Little questions
 

Post Reply  Post Oekaki 
 

Posted By Message

Jarzka



Registered
  26/12/2003
Points
  270

VIP Member
26th December, 2006 at 18:05:33 -

1) Is it possible to hide the ending of all files. I mean if you load these files to it:
1.txt
2.txt

it shows it like this:
1
2

Just the names without .txt.

2) Is it possible to load ONLY .txt-files if the folder contains .txt and some other files too.


 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
26th December, 2006 at 18:10:56 -

1) Use string parser with . as delimiter
OR
use the left function to get all characters between the first and the one before . (might need to get the length of the filename first to do that)

2) use the right$ function to check the last 3 characters of the filename

 
My signature is never too big!!!

Jarzka



Registered
  26/12/2003
Points
  270

VIP Member
26th December, 2006 at 18:15:37 -

I understood your help but I have never used those functions (or whatever they are).

So can you help me to fix this:

1) Load Tree -> Only Files -> "Example_Folder/"
I want to load the files without ".txt"

2) Load Tree -> Only Files -> "Example_Folder/"
I want to load only .txt-files

Thanks for you help already now.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
26th December, 2006 at 18:29:25 -

Mid$, Right$ and Left$ are string functions found in the expression editor. Right$ and Left$ allow you to enter a string and a number, and return that many characters from the relevant end of the string. Mid$ does the same thing but you also enter a number equivalent to the starting point, so it returns a specified number of characters from a specified point in the string.

I don't know if what Joe said is going to help you with your problem though since I haven't tested it, so don't take this as an endorsement. Just an explanation.

 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
26th December, 2006 at 18:55:51 -

It should work, you'd just need to compare each line in the tree object though.

And i dont know how to do that, and i dont have MMF/TGF to try it on.

 
My signature is never too big!!!

Werbad



Registered
  18/09/2002
Points
  235
27th December, 2006 at 05:19:58 -

Instead of loading the files using the Tree Control, load them into a List Object.
ex:

* Start Of Frame
- List: Load filelist from "Folder\*.txt"
- Start loop "Loop" List Nb Lines ("List") times
- List: Destroy

* On loop "Loop"
- Tree Control: Insert Item ( Left$( List Line Text$("List", LoopIndex("Loop") ), Len( List Line Text$("List", LoopIndex("Loop") ) ) - 4 ) ), -1, -2 )

The insert item expression takes all characters except the last 4 and adds them to the Tree Control

 
n/a

Jarzka



Registered
  26/12/2003
Points
  270

VIP Member
27th December, 2006 at 06:21:21 -

OK, thanks for help.

EDIT: Problem. The first line is empty?

Image Edited by the Author.

 
n/a

Jarzka



Registered
  26/12/2003
Points
  270

VIP Member
27th December, 2006 at 07:09:32 -

I made my own events and it's more simple

Start of frame:
Tree Control: Load filelist from "Folder/"
Start loop "Loop"

On loop "Loop":
String Parser: GetText$( "Tree Control", LoopIndex("Loop"))
Tree Control: Set Text -> ID: LoopIndex("Language"), Name: Left$(string$( "String Parser" ), length( "String Parser" )-4)

This deletes all type-texts (.txt).

Image Edited by the Author.

 
n/a

Werbad



Registered
  18/09/2002
Points
  235
28th December, 2006 at 04:51:02 -

IF the first line is empty, its because the list object has "Using 1-based index" checked...

 
n/a
   

Post Reply



 



Advertisement

Worth A Click