View Full Version : List Box help needed (total newbie)
shepparddon4182
04-15-2006, 10:12 AM
Hello,
I would like to run multiple quicktime movies from the list box. I used file.open and selected my movie and gave it a trial and it worked first time. After the initial trial I added several more movies and tested it again. Upon opening the second movie all that succeded it opened 1 after the other.
I had a look at the basic script tutorial but didn't seem to grasp the concept at all scripts and actions are all new to me. If anyone can help with what I should do for the action and script for quicktime movies to open from a listbox, so that only the nominated movie I click on opens and how I should set it up for multiple movies, ie; Global functions or whatever? I might get the idea.
I used buttons and quick action for the links no problems except I can open another movie while the current movie is still going and I don't what that to happen either. So ideally I want to open quicktime movies one at a time from the listbox and some script or action ? to stop further movies from being opened while a movie is allready running. So if anyone can give me guidelines on how I should go about this It might help a great deal for me to understand what to do.
Thankyou, :huh
shepparddon4182
azmanar
04-15-2006, 12:58 PM
Shep,
I felt the same way when I first used AMS. But at some points, I would definitely need to know how it works.
So I set-up my own reference area. Try out some building blocks (http://azman.info/ams) there. It is for starters.
shepparddon4182
04-16-2006, 07:47 AM
Thanx Azmanar for the building blocks perhaps I missed something as I didn't see any Actions and Script examples for what I'm trying to do.
In a List Box (Item text) I have several movies names listed, In (Item Data) I linked the files. I have 5 pages each a seperate categorie.
So in step by step I need guidance on a sensible approach how to do this !
Because there is so many movies for e.g Can I use a Global Function to get the movies to open and to stop other movies being opened while 1 is playing. If so what type of actions and scripts would I need to do this. If that is not a sensible or possible way what is.
I looked through the search and found some info on List Box problems and some examples of what other people did to fix there problems and I employed there examples but none of them worked for me unfortunately. I must be missing some basic stuff so where do I start. == I used file.open action like it suggested and like I said before it worked fine on 1 movie but after I added more it opened them all so do I need boolean or if & and, On Select, On Double Click or WHAT ! to open only the selected movie.
Can somebody please write a code example for me to try to do this as I noticed one guy was pulling his hair out and it wasn't until RoboBlue put an example code in that his problem was solved and then Worm gave another example that I didn't follow but was evidently a more correct way.
Hoping for an example or direction on how to do this ... :wow
Thankyou,
shepparddon4182
MrSmith
04-16-2006, 11:51 AM
Hello everyone this is my first post here. I think I've missed the boat along with shepparddon4182. I've searched the forum hoping to find a step-by-step guide on Listbox but to no avail. I have redesigned my project three times trying to work around my inexperience. The project I'm working on basically deals with PDF files. What needs to happen is when the equipment test form is selected from the right side listbox it can be printed once the print button has been selected. Also it has to have multiple selections because these people may be operating different pieces of equipment in one day. I will attach a part of this project hoping for guidance. Thank you for any help!
azmanar
04-16-2006, 01:37 PM
It really depends on how 1 want my ListBox populated. I have to decide early. It could be dynamically populated from SQLite, File Folders, Combo Boxes, Input, Text Files and from other ListBoxes as well.
If I want to populate my ListBox from a selected file folder, I need to create a button to look for folders. Once I selected the folder, it will populate my ListBox. In the OnClick of the button I put such script:
LB = "ListBox1";
--Disable listbox Updating
ListBox.SetUpdate(LB, false);
--Set default folder
folder = Dialog.FolderBrowse("Open Folder", _DesktopFolder);
--Set Default Extension
if folder ~= "CANCEL" then
ListBox.DeleteItem(LB, -1); -- this will clear previous list
-- tbSearchFiles = {"*.avi", "*.mpg", "*.dat"}; set your own file filters here
-- this one search all types of files
tbSearchFiles = {"*.*"};
for index,type in tbSearchFiles do
file = File.Find(folder, type, false, false, nil);
if file ~= nil and file ~="CANCEL" then
--do the following for each file:
for j,file_path in file do
--add the item to the listbox, with the name visible and path as data
tbFileParts = String.SplitPath(file_path);
sFile = tbFileParts.Filename..tbFileParts.Extension;
ListBox.AddItem(LB, sFile, file_path);
end
end
end
end
--Allow the listbox to display the updated content
ListBox.SetUpdate(LB, true);
As for executing any file selected from a ListBox that I want to open in its default reader, I prefer putting scripts in the OnDouble Click Area of the ListBox.
LB = "ListBox1";
-- Get the selected items
tSelected = ListBox.GetSelected(LB);
-- Only for single selection
if tSelected then
-- There is an item selected, get the data!
sFileToOpen = ListBox.GetItemData(LB, tSelected[1]);
File.Open(sFileToOpen, "", SW_SHOWNORMAL);
else
-- Display an error message
Dialog.Message("Error", "There is no item selected.");
end
The codes are just hacks from my sample (http://azman.info/ams) called : ListFiles.apz .
Of course, we just dont populate ListBoxes, we also need to edit, delete, save and etc.
For dealing with Media Player, you need to download and hack all 3 samples (http://azman.info/ams) I have.
I can help only upto this point. Hope it is useful.
MrSmith
05-04-2006, 01:50 AM
Hello again,
I have a listbox with 14 listbox items. How do I set up the listbox to display a PDF file once it's double clicked on. I can get one PDF file to display but once I double-click on any of the other selections the same PDF file displays. Or both files appear the same time, what am I doing wrong?
azmanar
05-04-2006, 03:11 AM
Alo Mr Smith,
Go to this sample site (http://azman.info/ams) and search for
AMS 6 [ Dynamic List Box ] Examples:
> Dynamically list Files from chosen Folder into a List Box.
Download the APZ file.
Place all your PDF files in 1 folder anywhere. Open it with the sample AMS app. Double click and check the behaviour whether you face the same problems.
If not, you can checkout the method I used that might be useful for your purpose.
MrSmith
05-12-2006, 11:31 AM
azmanar
Thank you for your examples, just what I needed.
MrSmith
05-14-2006, 02:30 PM
Hello again more questions, Lets say I have a listbox with more the twenty PDF selections. How can I select more the one file at once and files I've selected be Highlighted showing I've selected them for printing? Thanks
yosik
05-14-2006, 02:49 PM
From the help file:
Options
MultipleSelection
Enable multiple listbox items to be selected at one time. Choose from:
True
Multiple items can be selected in the object at one time.
False
Only one listbox item can be selected at one time.
Hope that helps
Yossi
MrSmith
05-14-2006, 04:01 PM
Yes I've read that topic in the Help file, but No-Go! "True = Multiple items can be selected in the object at one time". That is my current sitting.
Roboblue
05-14-2006, 07:43 PM
Not knowing how experienced you are in windows operations, I will make a suggestion you may already know.
When making multiple selections in the List box, you must either use Ctrl + click to select individual lines, or Shift + click to select several consecutive lines.
mikeln
06-07-2008, 01:28 AM
My god you guys are pure genius.
I dunno where i would be without this place.
I like to try and spend 48 hours smashing my head on the keyboard
before I come in here.
But the people here are real cool and nothing is a problem.
azmanar ....i could just kiss you sometimes...( not really, but..):yes
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.