PDA

View Full Version : Two Listbox in the same project


Brave Heart
07-28-2006, 08:21 AM
Hi,

How can I use two different Listbox in the same project and each listbox
has its own pages?

Any examples?

Hope it's clear.

Thank you.

yosik
07-28-2006, 08:57 AM
What do you mean by "has its own page"s?
No problems to have two LBs, each one behaving separately.
Please explain

Yossi

Animl
07-28-2006, 06:53 PM
Hi,

How can I use two different Listbox in the same project and each listbox
has its own pages?

Any examples?

Hope it's clear.

Thank you.

As long as the LBs have different names, which AMS will force, you can do as many LBs as you want. One LB calls on this and one on that. No different really then using one big one. I know that's not what you're looking for but I used it as an example. If possible try loading the information used to process in the Data slot. If say you use the same reg address except for the Value, just put the value in the data, and a Variable in the Value part of the address to accept what ever is passed ot it.

Hope I made some sense. Some guys here are better at describing things then me.

Brave Heart
07-29-2006, 06:17 AM
Thanks for replying.

Could you plz have a look to the atached file? It may make my idea clearer.

http://www.sendspace.com/file/opbqn6

The problem is that whenever I add a new page to one of the LBs it also
appears in the other one.

Now, I want to add several pages to (Stories List) and others to (Movies List)
but I don't want them to get mixed.

Thanks a lot.

stickck
07-29-2006, 07:35 AM
your ZIP file is broke. winzip doesnt recognize it.

chris

Brave Heart
07-29-2006, 09:24 AM
Here is the file again. It's copressed with winrar.

http://www.sendspace.com/file/sbejj9

Thanks

stickck
07-29-2006, 12:26 PM
your problem is... you only have 3 pages. Main....Movies.....Stories

you have this code (this is copied from the Movies page.

-- get the pages
tbl_Pages = Application.GetPages();

if tbl_Pages then

-- clear the listbox
for num_Item = 1, ListBox.GetCount("ListBox2") do
ListBox.DeleteItem("ListBox2", 1);
end

for num_Index, str_PageName in tbl_Pages do
ListBox.AddItem("ListBox2", str_PageName, "");
end
end


it looks like you want a seperate page for each movie/stories.

well you need to create the pages for those movies/stories, one per page.

name the pages movie1, movie2, movie3, .... same for the stories.

then you can use this script.

-- get the pages
tbl_Pages = Application.GetPages();

if tbl_Pages then

-- clear the listbox
for num_Item = 1, ListBox.GetCount("ListBox2") do
ListBox.DeleteItem("ListBox2", 1);
end

for num_Index, str_PageName in tbl_Pages do
nMovie = String.Find(str_PageName, "movie", 1, false)
if nMovie ~= -1 then
ListBox.AddItem("ListBox2", str_PageName, "");
end
end
end

it will step through the table and only put the pages that have the word MOVIE in its title into your listbox.

change the text in red to stor and it will do the same for that listbox too.


now, the way i would go about doing this is, put the movies you want in your project into one folder (AutoPlay\ Videos)

the same for the stories (AutoPlay\Stories)

then you would only need one page (you also only need one page with the way you're working it right now) with 2 listbox's

Use this script to fill both listbox's with the contents of the folders.

----On your Page-Show
ListBox.DeleteItem("ListBox1", -1);
ListBox.DeleteItem("ListBox2", -1);
tVids = File.Find("AutoPlay\\Videos", "*.*", false, false, "", "")
count = 1
for y,z in tVids do
ListBox.AddItem("ListBox1", "Movie"..count, z)
count = count +1
end

--On Your Listbox's
tSelected = ListBox.GetSelected("ListBox1")
GO = ListBox.GetItemData("ListBox1", tSelected[1])

Dialog.Message(tSelected[1], GO, MB_OK, MB_ICONNONE, MB_DEFBUTTON1

HTH

Chris

Brave Heart
07-29-2006, 03:43 PM
Thank you very much.

I found some difficulties to aplly the codes you already posted.

Could you plz help me with an example.

Thanks

Roboblue
07-29-2006, 09:01 PM
Brave Heart and other interested newbies
Here is a simple little learning example that will display almost all of the media supported in AMS 6. It only uses 2 pages to do so. A Menu and Media Viewer page.
There are several listboxes on the menu page to "drill" down to the media type. These are populated from the files in folders under the project AutoPlay directory (Docs, Audio, etc.) I included a sample of each media type except video missing to keep the .apz size down).
All info labels are set by media selected.
It has the Media Player plugin (for video and music.), Web (which can support several text formats, html, text, .doc, .rtf, even PDF if the system has Adobe reader installed, etc), Image, and Flash all on one page. The viewer type is set by a variable when the media type is selected prior to the page jump.
Just put your media files in the folders shown in the script. It is simple, so there's room for lots of custom tweaks.

Brave Heart
07-30-2006, 08:00 AM
Thank you Robo.

But what I really need is what stickck suggested in reply 7. I need an example

to apply the codes he posted.

Thanks

stickck
07-30-2006, 06:58 PM
Sorry. i only have Version 5 at work. it should convert just fine to Version 6.

Chris