PDA

View Full Version : I Need Help pls - ListBox


dec
02-11-2009, 09:07 AM
Hello,

I cant show text file from listbox in a pragraph

please tell me how

show My project in attachments

Thanx alot

Imagine Programming
02-11-2009, 10:05 AM
woah almost one letter per page :p just kidding...

Please attach the exported project file (File > Export)

dec
02-11-2009, 10:37 AM
thanx

am sorry take a export file in attach

thanx alot

jackdaniels
02-11-2009, 10:41 AM
here is a good example for you

dec
02-11-2009, 11:30 AM
hi Jack

Thanx for Example

but i want show a text file from Docs Directory to Paragraph chose from listbox

lock attachment

thx again

XeroX
02-11-2009, 04:06 PM
First of all ... hi.

I am not as skilled as others, but i hope this will help you.

I know there is an "easier" solution, but sorry.

Anyway hope this will help you ;)

((Hope it's that what you want ... I'm a bit confused at the moment ^^))

jackdaniels
02-11-2009, 04:15 PM
Put this code sto ur project and try...

Page On Show Code :
tEntries = File.Find("AutoPlay\\Docs\\", "*.txt", false, false, nil, nil);
nEntries = Table.Count(tEntries);
nEntriesStart = 1;
repeat
tPath = String.SplitPath(tEntries[nEntriesStart]);
ListBox.AddItem("ListBox1", tPath.Filename, tEntries[nEntriesStart]);
nEntriesStart = nEntriesStart + 1;
until nEntriesStart > nEntries

ListBox On Select Code :
tSelected = ListBox.GetSelected("ListBox1");
if tSelected ~= nil then
for index in tSelected do
sSelected = ListBox.GetItemData("ListBox1", tSelected[index]);
sSelectedText = TextFile.ReadToString(sSelected);
Paragraph.SetText("Paragraph1", sSelectedText);
end
end

dec
02-12-2009, 07:07 AM
XeroX

Thanx aloooot
yes this is good now is working

thank u thank u brother so mutch

Jack

am try your code but in page code when i perview show message is line 2 problem can u check and thanx for every thing brother

i'll wait u

jackdaniels
02-12-2009, 08:24 AM
ok try like that;

Page On Show Code :
tEntries = File.Find("AutoPlay\\Docs\\", "*.txt", false, false, nil, nil);
if tEntries ~= nil then
nEntries = Table.Count(tEntries);
nEntriesStart = 1;
repeat
tPath = String.SplitPath(tEntries[nEntriesStart]);
ListBox.AddItem("ListBox1", tPath.Filename, tEntries[nEntriesStart]);
nEntriesStart = nEntriesStart + 1;
until nEntriesStart > nEntries
end

ListBox On Select Code :
tSelected = ListBox.GetSelected("ListBox1");
if tSelected ~= nil then
for index in tSelected do
sSelected = ListBox.GetItemData("ListBox1", tSelected[index]);
sSelectedText = TextFile.ReadToString(sSelected);
Paragraph.SetText("Paragraph1", sSelectedText);
end
end

dec
02-14-2009, 10:33 AM
hi jack

is work ok but i dont want showing a txt file name in the list i want is work with my list

thanx so mutch man