PDA

View Full Version : Listbox & Global List Madness


Option_Explicit
11-12-2003, 07:36 PM
Ok what I'm doing is creating a text file with a list of web addresses and and Desriptions for each address. - ie: "AMS Support;;http://www.indigorose.com/forums"
so I'm using this to read the text file then seperate the descriptions to a listbox, and the web addresses to a Global list.

ListBoxObject[AListBox].Remove (All)
%URLFileL% = TextFile.CountLines ("%SrcDir%\List\url.txt")
%URLVar% = "0"
WHILE (%URLVar% < %URLFileL%)
%TextLine% = TextFile.GetLine ("%SrcDir%\List\url.txt", %URLVar%)
%URLText% = String.GetDelimitedString ("%TextLine%", ";;", 0)
ListBoxObject[AListBox].Add (End, "%URLText%")
%URLText% = String.GetDelimitedString ("%TextLine%", ";;", 1)
GlobalList[URLGlobalList].Add (End, "%URLText%")
%URLVar% = Evaluate (%URLVar% + 1)
END WHILE

Now as long as I add the items to the end of each Listbox/Global list, the index numbers should be the same for each, so when I call up from listbox index 4 the corrosponding index 4 in the global list will be the correct address for the listed description..

ie:
%SelectedIndex% = ListBoxObject[AListBox].GetSelected
IF (%SelectedIndex% = 0)
%ListItem% = GlobalList[URLGlobalList].GetItem (0)
File.Open (open, "%ListItem%")
END IF


I can't find a condition to verify that the I am getting the correct web address for the listbox selection I make.
Am I out to lunch on this?
BTW: I need to use a textfile, so users can edit their own list of Urls to keep, without keeping all this within the .exe file.

Corey
11-12-2003, 07:53 PM
I can't find a condition to verify that the I am getting the correct web address for the listbox selection I make.
Am I out to lunch on this?
Message dialogs can be inserted anywhere in your code to test values at runtime, i.e. when you click the listbox a message dialog can display the value for you.

Other than that I didn't really see a specific question in your post, hope that helps...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Option_Explicit
11-12-2003, 08:37 PM
well corey, I did this for the listbox

%SelectedIndex% = ListBoxObject[AListBox].GetSelected
IF (%SelectedIndex% = %SelectedIndex%)
%ListItem% = GlobalList[URLGlobalList].GetItem (%SelectedIndex%)
File.Open (open, "%ListItem%")
END IF

and it seems to work,

What the question was, I wasn't sure if adding items to the global list would keep the same index numbers as the listbox items reliably.
When i %SelectedIndex% = 6, then %ListItem% = 6 better have the correct data.
this code did make sense as to what I'm trying to accomplish?

anyway, all seems to work:)

Corey
11-12-2003, 09:05 PM
Cool.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)