PDA

View Full Version : List box working with 2 web browsers



angelo
03-18-2003, 07:45 AM
Hi, how can I make that when I select an Item from a list box it shows a different text or object on each browser if i have two of them?

Derek
03-18-2003, 08:12 AM
Hi angelo

Something like this will work:

%SelectedIndex% = ListBoxObject[ListBox1].GetSelected
IF (%SelectedIndex% = 0)
WebBrowserObject[WebBrowser1].NavigateTo ("?\address\file.htm")
ELSE
IF (%SelectedIndex% = 1)
WebBrowserObject[WebBrowser2].NavigateTo ("?\address\file.htm")
END IF
END IF

Lorne
03-18-2003, 09:31 AM
If I understand you correctly, the problem is how to store two different addresses in a list? So that when you click on one item, you can get two different URLs, one for each Web Browser Object?

If so, it's actually pretty simple. First, I'll assume you're using the item::data notation, to have a descriptive title in the list (like "Hilarious Antler Antics Page") along with a hidden data element, where you will store the URL.

To get more than one URL in the data part, just use a delimited list. Like so:

text::URL1||URL2

Using || as a delimiter to separate URL1 from URL2. You can use any delimiter you want, so long as it's different from :: and, if you're adding items to the list box with actions, also different from the delimiter you use in the Add Items action (which is ;; by default -- that's why I used || in this example).

Hilarious Antler Antics Page::http://www.antlerantics.com||http://www.fbi.gov/reportpoachers.html

When you wanted to get the URLs for the selected item, you'd just use a "List Box - Get Data" action, to get a delimited list like this:

http://www.antlerantics.com||http://www.fbi.gov/reportpoachers.html

...and store that in a variable. Then, you'd use two "String - Get Delimited String" actions to get item 0 and item 1 from the list (in that variable) and store each URL in a variable. Then use the variables in "Web Browser Object - Navigate To" actions. Note: in the "String - Get Delimited String" actions, make sure you set the delimiter field to || or whatever you decided to use as the delimiter.