PDA

View Full Version : List Box


AndrewClark
07-01-2002, 07:30 AM
I have added 5 items in the List Box Items. I want the user to be able to click on an item and view a PDF file. There will be five different PDF files, one for each list item.
At the moment I cannot find a way to associate a single PDF with a single list item. I have tried to select an item under the "Settings" tab, go to the "Actions" tab and under "Available Actions" select the file I want to open. However, this appears to apply to every item in the list. I have checked the documentation but clearly I have missed something.
Please help.
Regards
Andrew

njlech
07-01-2002, 08:19 AM
I am also having the same problem. To test this, I am putting 5 items in the list box and attempting to assign a separate Execute File action for each item. I get the same as Andrew, the function will work for all items in the list. I cannot find to a way to distinguish the items to do separate actions. Do I need to write an IF statement or something for each item?

Brett
07-01-2002, 08:57 AM
The List Box object actually allows you to associate a data member with each item. You do this by following the item's text with a double colon. So, you could make a List Box | Add action that adds:

Document1::%SrcDir%\doc_one.pdf;;Document2::%SrcDi r%\doc_two.pdf

Now, go to the On Double-Click action for the List box and get the selected item using the Get Selected action. Then use the Get Item Data action to get the item's data. This will be the path to the file associated with the item.

Here is a List Box object that I have copied to my clipboard that will illustrate this. Copy this text to your clipboard and then paste it into AMS40 as a new object:

<IR_CB_OBJECTS>
<SourcePageName>Untitled</SourcePageName>
<Object>
<Type>9</Type>
<Name>ListBox1</Name>
<VisibleAtDesignTime>1</VisibleAtDesignTime>
<VisibleAtRunTime>1</VisibleAtRunTime>
<Locked>0</Locked>
<LockSize>0</LockSize>
<ToolTip/>
<Cursor>0</Cursor>
<Coordinates>
<Top>62</Top>
<Bottom>365</Bottom>
<Left>166</Left>
<Right>419</Right>
</Coordinates>
<Hotkey>
<VirtualKey>0</VirtualKey>
<Modifiers>0</Modifiers>
</Hotkey>
<Event>
<Name>On Selection Changed</Name>
</Event>
<Event>
<Name>On Double-click</Name>
<Action name="Get Selected">
<Type>126</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<TargetListBox>ListBox1</TargetListBox>
<Variable>%SelectedIndex%</Variable>
<VariableDelimiter>;;</VariableDelimiter>
</Action>
<Action name="Get Item Data">
<Type>121</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<TargetListBox>ListBox1</TargetListBox>
<Index>%SelectedIndex%</Index>
<Variable>%ItemData%</Variable>
</Action>
<Action name="Message Box">
<Type>5</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<DialogTitle>Item Data</DialogTitle>
<DialogMessage>The item's data is:

%ItemData%</DialogMessage>
<Icon>2</Icon>
<Variable>%Result%</Variable>
<DialogType>0</DialogType>
<DefaultButton>0</DefaultButton>
</Action>
</Event>
<Text>
<ListData>Item One::DATA1;;Item Two::DATA2</ListData>
<TextColor>0</TextColor>
<BackgroundColor>16777215</BackgroundColor>
<UseCustomFont>0</UseCustomFont>
<FontName>Arial</FontName>
<StyleName>Regular</StyleName>
<CharacterSet>0</CharacterSet>
<Height>14</Height>
<Weight>400</Weight>
<Italic>0</Italic>
<Underline>0</Underline>
<StrikeOut>0</StrikeOut>
<Antialias>1</Antialias>
</Text>
<Window>
<HasBorder>1</HasBorder>
<SunkenBorder>1</SunkenBorder>
<VerticalScrollbar>1</VerticalScrollbar>
<HorizontalScrollbar>0</HorizontalScrollbar>
<Sort>1</Sort>
<MultipleSelect>0</MultipleSelect>
</Window>
</Object>
</IR_CB_OBJECTS>

Brett
07-01-2002, 10:00 AM
See this (http://www.indigorose.com/ubbthreads/showflat.php?Cat=&amp;Board=ams4beta&amp;Number=7452&amp;page= 0&amp;view=collapsed&amp;sb=5&amp;o=0&amp;fpart=) post for an example page that you can import.

- Brett

AndrewClark
07-01-2002, 11:08 AM
Brett,
I have followed your instructions, or at least, I think I have, and I am still missing something.
In the Settings tab I have typed the viewable name followed by two colons and the name of the PDF eg:

First PDF::%SrcDrv%\MyPDF.pdf

In the actions tab I have:

%ItemData% = ListBoxObject(PDF List).GetItemData (0)
%SelectedIndex% = ListBoxObject(PDF List).GetSelected
File.Open = (open, "%SelectedIndex%")

Presumably I need File.Open somewhere. Can you help please?

Brett
07-01-2002, 11:33 AM
You have the actions reversed and a bit wrong. Try:

In the actions tab I have:

%SelectedIndex% = ListBoxObject(PDF List).GetSelected
%ItemData% = ListBoxObject(PDF List).GetItemData (%SelectedIndex%)
File.Open = (open, "%SelectedIndex%")

njlech
07-01-2002, 01:19 PM
I have one for you, Brett. Once I have gathered all desired files from a directory, how would I go about counting the number of files and displaying the number in another text field?

AndrewClark
07-02-2002, 03:42 AM
Brett,
When using my beta product at Run Time, I click on the first item in the list box. I get the following error message:

Error opening file.
There is no application associated with the given file name extension.
0

This implies that it is finding the first PDF file in the list, but that the associative feature of Windows is not functioning.

When I click on the second and subsequent items in the list I recieve the error message:

Error opening file.
File not found.
1

The syntax I am using under List Items is:

ItemName::%SrcDrv%\Distribution\NameOfFile.pdf

As a general comment, I would have wished for a far more intituitive way of working with list boxes. At Design Time I would like to select an item in the list box and then click an Action tab for that item only. After setting the action, I would then move on to the next item until the list is finished. Currently it is not at all intuitive.
Andrew

fredkauf
07-02-2002, 06:28 AM
I agree AMS4 has some very nice features,I think it forgot that many of us like me are not script writters the features need to be much more intuitive, I have been trying to get a list box to work and have been frustrated with all the scripting needed..

Mark
07-02-2002, 10:09 AM
Hi,

In your File.Open action try using:

File.Open (Open, "%ItemData%")

instead. Or try using a Dialog.ShowMessage action to display the contents of your variables.

mark.

AndrewClark
07-02-2002, 10:45 AM
Mark,
Thanks for that. After a bit of tweaking of the paths it now works. Where I had %SrcDrv%\Distribution\Filename.pdf it was giving me an error message saying that it could not find ...\Distribution\Distribution\Filename.pdf. I removed "Distribution" from the string and it works.

I need to reiterate that the list box functionality should be far more intitutive and "gui-fied". I use javascript in Acrobat for form field handling and open document functions, so I am comfortable in a pure scripting environment. However this half-way-house situation is awkward to work with. In AMS3 you could build up a script without realising that you were doing it. If you can you should certainly have a point and click solution for the list boxes. For more advanced applications you might offer some AMS-specific javascript objects where more customised functionality is required.

njlech
07-02-2002, 11:12 AM
Excellent idea. Giving the option to embed javascript type functions into AMS4 would be fantastic!

Mark
07-02-2002, 11:35 AM
Hi,

Thanks for the input on the List Boxes; we definitely appreciate all comments that we receive.

The nice thing about the Lost Boxes is that they are very flexible, and allow you to create some really neat menus. Admittedly they do have a learning curve.

Hopefully you guys will continue to test and use the List Boxes, and keep giving us feed back about them.


mark.

fredkauf
07-02-2002, 11:56 AM
I think there might be a little to much flexibility, a point and click for my use would be great with an option for those who need more.

Mark
07-02-2002, 12:31 PM
Hi fredkauf,

What sort of options do you (or anyone else for that matter) think would make the List Box easier to use? Please be specific about what changes you would like to see and what you might use the List Box for.

mark.

AndrewClark
07-02-2002, 03:50 PM
Mark,
I would want to use the list box so that the user could easily browse a list of PDF files and other documents that are being delivered on the CD. The user could scan down the list and select a file that they would like to view.
The feature that would make the list box easier to use at design time would be the ability to treat each item in the list as an object, though perhaps with a limited range of actions. The methodology you described is brief in that the action only has three lines of script, but it is not at all obvious what the scripts do. Also, having a name::value pair under the first tab is awkward. What would be useful there would be a simple dialog box like the boolean box in AMS3. The headings of the three edit boxed could be:

Name to appear in list box
Action (open, print, copy etc)
Target file

It would be important to be able to copy and paste the Action and Target file, as these change only slightly from list item to list item. For example, there could be a collection of PDFs named File1.pdf to File30.pdf. It would be valuable to do a mass copy and paste and then simply edit the number in each file to associate the list item with the correct file.

Andrew

Mark
07-03-2002, 02:47 PM
Hi,

Thanks for the post Andrew, if you are adding files to your List Box you should look into using the ListBox.AddFiles action.

If anyone is having problems with the List Box Objects, I suggest they take a look at Adam's sample project.
http://www.indigorose.com/ubbthreads/showflat.php?Cat=&amp;Board=ams4beta&amp;Number=7695&amp;page= 0&amp;view=collapsed&amp;sb=5&amp;o=0&amp;fpart=

It's a very good example of how to use a list box.


mark.

fredkauf
07-03-2002, 04:22 PM
Mark I am not a programer,code writter etc, I need something easy to use, simple intutive interface, AMS3 had much of that,AMS4 is difficult to navigate and just get simple things done. If AMS3 had an upgrade AMS3.5 that had Flash and Video, sizing and a small hand full of others I would put my money down now. I am not a code writter nor want to be I need the ease of point click,darg and drop and not sitting and writting code on where to put things or where to get them from.

Mark
07-04-2002, 09:21 AM
Hi,

Have you looked at Adam's example? It's quite an interesting example of what can be done with AutoPlay 4.0, and it might help you understand some of the more advanced concepts.

If you wanted to you could use AutoPlay 4.0 as though it was AutoPlay 3.0 or AutoPlay 3.5 you can, you don't have to use any of the more advanced features. If you want to execute a program use File.Execute (just like 3.0), if you want to jump to a page use Page.Jump, and if you want to open a document use File.Open. 4.0 offers you more objects and more flexibility, you don't have to use the flexibility mind you, but it's nice to have.

AutoPlay 4.0 still has the ease of point and click and drag and drop, you don't have to write any "code" if you don't want to. If all you want is a flash movie then add a flash movie to your project, and start it playing with a Flash.Play action.

I think once you start getting use to AutoPlay 4.0 you will see how simple it really is.

Thanks for your comments.


mark.