View Full Version : List Box Problems
DaNiK
02-10-2003, 01:03 PM
Hello!
I have made a listbox and instert some items (progs) , now I want the following-
when you select one of the items , it must start a selected program from the list
by the clicking on button.
who knows how to do this?
Thanks
RobbyH
02-10-2003, 01:18 PM
Sure, this can be done quite easily.
You could have it as a double click on the listbox to activate the program, or, like you said, you could have a button.
First off, you will need to know what the user has selected.
There are two easy ways to go from here.
The first requires that you have stored some data with the text in your listbox.
You can do this by inserting an item in to the listbox like this.
Example: My Program::%SrcDir%\%ProgramFiles%\My program.exe
The data is separated by the double full colon.
You can then use the listbox action "get selected" to get the index # of the item that is selected. Then, use the "get item data" action to get the data for that item. Use the variable created in the "get selected" action to tell AMS what it's index # is. If you have stored the pathname in this data, it would be easy to run the program, as the full path is stored for you. Just use the file execute action, and in the pathname, put the variable from the "get item data" action.
Another simpler way, would be to use the "If" action.
You could simply use the "get item text" of the selected item(s) to get the program name.
You could utilize the "If" action here by saying something like this.....
If(%selecteditemtext% = My Program The "if" action
file.execute("%SrcDir%\MyProgram.exe") File execute action
End If Ends the if action
If you have more than one program, use more than one if action to get the same results
i.e.
If(%selecteditemtext% = My Program2 The "if" action
file.execute("%SrcDir%\MyProgram2.exe") File execute action
End If
For more help, please type "listbox" in the index of the AMS help file.
Robby
DaNiK
02-10-2003, 01:32 PM
I read this topic , but i still dont understand how to do it,
I use item::data , it works , but I dont know how to use
"select item from the list box" and how to do button which
start programm from the list(select from the list then press button , and program (data) must run.This is what I want.
John-oh
02-10-2003, 02:46 PM
Try 'On Selection Changed'
<IR_ACTIONS_LIST>
<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="Jump">
<Type>1</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<PageName>%ItemData%</PageName>
</Action>
</IR_ACTIONS_LIST>
Page name will need to be the same as the list box
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.