View Full Version : Question about ListBox and Data (delimited List)
SonG0han
12-16-2003, 05:12 AM
its me again ;)
in AMS4 i used several listboxes to store information or make file listings with some data assignet to them. most times i had multiple things as data in a delimited list (var1;;var2;;var3) but in AMS5 there are no del. lists? now there are tables?
but how can I "add" an table as data to a listbox entry or put the data in a table? it seems it was easier in AMS4 :confused:
i found the Table.Concat feature which returns a delimited list but if i have a del. list as data of a listbox object, how can i put it into an table? :confused:
hope someone knows how to do it.
TJ_Tigger
12-16-2003, 10:07 AM
There is a script in AMS 5 that will parse a delimited list. Look at the scriplets in your Gallery.
SonG0han
12-16-2003, 10:21 AM
ah, thank you! :D
just took a look at it. i think it will take a while to understand how it works. ;)
but there is one last thing i want to ask.
at the end of the file there is some code to "Purpose: Makes a table into a delimited string" but isnt that what Table.Concat does? :confused:
TJ_Tigger
12-16-2003, 11:10 AM
Yes, there are actually two functions in that scriplet, one takes a delimited string to a table and the other from a table to a delimited string. The second is not necessary since there is the Table.Concat function. This could have been created before that Action existed, maybe?
SonG0han
12-16-2003, 11:40 AM
could be :)
i know how it works now :D
but i encountered another issue :(
i have a "mini browser" with favorites. its a listbox where name and url (as data) is saved. i save it to a .ini file and read it on startup but i cant figure out yet why i have to incese the tablecount by 1.
here what i wrote.
on Startup:
tblFavorites = INIFile.GetValueNames(_SourceFolder.."\\Settings.ini", "Favorites");
tblFavoritesCount = Table.Count(tblFavorites);
on Page Preload:
FavoritesCounter = 1;
repeat
FavName = tblFavorites[FavoritesCounter]; -- i couldnt use tblFavorites[FavoritesCounter] in the next line in a ini.getvalue command, got error that it must be a string
FavURL = INIFile.GetValue(_SourceFolder.."\\settings.ini", "Favorites", FavName);
ListBox.AddItem("Favorites", FavName, FavURL);
FavoritesCounter = FavoritesCounter + 1;
until FavoritesCounter == tblFavoritesCount + 1
in the last line i added +1 at the end. if i dont do this i get an error if there is only 1 entry in the favorites secton of the ini and if there are more the last entry in the ini is not read and displayed in the listbox. but why? the count of the table starts at 1 and the counter starts at 1 too :confused: :confused: :confused:
btw: if i use while it doesnt work either.
---------------------------------
another thing i have noticed: set ini value does not recognize the difference between "test" and "TEST".
take a look at this:
CurrentURL = Web.GetURL("Browser");
CurrentURLName = Dialog.Input("Enter the name for your new Favorites entry", "Name of current Page:", "", MB_ICONQUESTION);
if (CurrentURLName == "") or (CurrentURLName == "CANCEL") then
Dialog.Message("Error", "You must enter a name for the new entry.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
else
ListBox.AddItem("Favorites", CurrentURLName, CurrentURL);
INIFile.SetValue(_SourceFolder.."\\Settings.ini", "Favorites", CurrentURLName, CurrentURL);
end
it successfully adds the new entry "TEST" to the list (if you enter TEST into the dialog box) but in the settings.ini the entry "test" will be overwritten.
is this a known issue? :confused:
SonG0han
12-18-2003, 03:05 PM
will this be fixed in the next version and can anyone answer my question above pls? :)
Ted Sullivan
12-18-2003, 05:03 PM
INI files are not case sensitive.
SonG0han
12-19-2003, 05:42 AM
so you won't/can't change this in 5.0.0.3, right? :(
hmm ok. seems I have to change it and compare existing entries with the entry that will be added, saw something like that in the helpfile. thx for response.
Ted Sullivan
12-19-2003, 09:47 AM
That's just the way INI files are and the way the Windows API has been written since Windows 3.0. We really can't do anything about that.
SonG0han
12-20-2003, 01:47 PM
ok, thanks :)
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.