Search for file and literally "list buttons"

joel2009

Member
Licensed User
I'm not exactly where to even start on this, i would like to search for a file type in a diretory (.txt) and list them, on click i need to be able to parse the text document.

I know i will need the dirSearch, file read, and a binary object (and i guess some type of array from the example i saw) (i'm not very farmiliar with arrays at all though)..... but i don't know how to even list the objects in the first place.

Can someone help point me in the right direction to get started?




Thanks in advanced,

Joel
 
Last edited:

N1c0_ds

Active Member
Licensed User
I'm not exactly where to even start on this, i would like to search for a file type in a diretory (.txt) and list them, on click i need to be able to parse the text document.

I know i will need the dirSearch and file read and a binary object and i guess some type of array from the example i saw (i'm just not very farmiliar with arrays at all)..... but i don't know how to even list the objects in the first place.

Can someone help point me in the right direction to get started?




Thanks in advanced,

Joel

You can separate and parse the list with StrSplit (and all other String keywords). Then use For statements to repeat an action for each item in an array (using arraylength).

Look in "keywords" in the help file. You will find a lot of info for what you are trying to do.
 

joel2009

Member
Licensed User
Thanks Nick i'll take a look


EDIT: By the way, I'm Getting ready to send you an email you need to see pertaining to your project so make sure you check it
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should use FileSearch:
B4X:
FileSearch(ArrayList1, AppPath, "*.txt")
This code will fill ArrayList1 with all the paths of txt files located in the current folder.
Afterward you can add these to a listbox:
B4X:
For i = 0 to ArrayList1.Count - 1
 ListBox1.Add(FileName(ArrayList1.Item(i))) 'Use FileName to omit the complete path
Next

Then you could catch ListBox_SelectionChanged event and use ArrayList1.Item(Index) to get the full path to the selected item.
 

joel2009

Member
Licensed User
Thanks Erel worked like a charm Is there any way to add an image to the contol... or is only text allowed? I know the freewarepocketpc client some how add a screen shot but i looked as though it may be a seperate control? (I would like to actually use the image as a background for the buttons)
 
Last edited:

N1c0_ds

Active Member
Licensed User
Thanks Erel worked like a charm Is there any way to add an image to the contol... or is only text allowed? I know the freewarepocketpc client some how add a screen shot but i looked as though it may be a seperate control? (I would like to actually use the image as a background for the buttons)

AddImage? You can add an image control with it. You can also toggle the Visible property to hide an image while not in use.
 

joel2009

Member
Licensed User
you can use that to add the iamge to the list box? i was going to try and go for a list style similar to the layout i was using for jak portal
 

N1c0_ds

Active Member
Licensed User
Oh. Uh. No.

But you can make a panel within a panel. Say inpnl and outpnl. Add all the stuff required on inpnl, set its height and move it up and down with a scrollbar.

This way you can display something similar to your PIE frame. The sad part is that you can't draw on a panel so you'll have to use less efficient methods such as addimage. Tell us more about what you want to do and I could give you a bit of code.
 
Top