PDA

View Full Version : Bugs, Errors, Questions and all the other stuff


SonG0han
12-16-2003, 04:06 PM
hi AMS5 Team!
I have noticed some things I want to tell you. I dont know if they are already known or not, pls take a look at it. :)

i put everything from bugs, errors and Questions in here to keep the forums ordered. I think it doesnt look "so good" if there are 20 threads from the same user and everyone has only a minor question in it, right? :rolleyes:

here we go...

1. if i enter text in an input field (not in ams runtime, in designtime) they get screwed up. text is mixed and its just crappy black text you cant read. maybe there is a way to fix it?

2. if I use a web object and put the url in an input field (like in the template browser) you get the URLs of iFrames in the inputfield. is there a way to disable this or does a workaround exist?

3. if I execute a link which opens a new window in a web-object with javascript nothing happen

4. it seems the + key is not recognized by AMS5. the following code example should do something if you hit the + key but nothing happens. if i use other keys it works.

if (e_Key == 43) then
----ACTION HERE
end


5. Just added some bookmarks to my global functions but if i leave the codeeditor and come back all bookmarks are gone. tried it several times. can you confirm this?

thats all. Thank you for your time and patience. :)

Lorne
12-16-2003, 04:36 PM
In answer to 4:

The virtual key code for the + key on the numeric keypad is 107.

The code for the + key on the main part of the keyboard is actually a shifted =, so in other words it's 187 when the shift key is held down.

SonG0han
12-16-2003, 04:43 PM
oh, forgot that with the shifted = on english keyboards! :o
i have a + key on my german keyboard, with shift I get a * and with altGr i get ~. i tried this +-key and the one on the numpad and thought that is the + (ASCII 43 in the table in helpfile)

shift + = on my keyboard is an question mark (?). i try if 187 is the +-key on my keyboard tomorrow, time for bed now ;)

Thank you very much!! :)

SonG0han
12-20-2003, 01:46 PM
hi!
I hope someone can help me, i have a problem with the following code:

-- DATEN-Datei einlesen (Section Names)
-- ALT: DATA = TextFile.ReadToString(_SourceFolder.."\\DATA.ini");
-- Tabelle Leeren
DATA_Sections = {};

DATA_Sections = INIFile.GetSectionNames(_SourceFolder.."\\DATA.ini");
-- Namen der neuen Kategorie abfragen
NewCatName = Dialog.Input("Enter name of new Category", "Category Name:", "", MB_ICONQUESTION);
-- Prüfen ob die Kategorie schon existiert
-- (Suche in strDATA - siehe oben)
-- ALT: SearchResult = String.Find(DATA, NewCatName, 1, false);
strDATA_Sections = "";
strDATA_Sections = Table.Concat(DATA_Sections, ";", 1, TABLE_ALL);
Dialog.Message("DEBUG", "Daten: "..strDATA_Sections);
CatSearchResult = String.Find(strDATA_Sections, NewCatName, 1, false);
Dialog.Message("DEBUG", "Daten: "..CatSearchResult);
-- Wenn Sie noch nicht existiert am Ende des Files anhängen
if (CatSearchResult == -1) then
string = "\r \r["..NewCatName.."]\r"
Dialog.Message("DEBUG", "Daten: "..string);
TextFile.WriteFromString(_SourceFolder.."\\DATA.ini", string, true);
Dialog.Message("DEBUG", "Daten: ".."INI geändert!");
else
result = Dialog.Message("Error", "This Category Name does already exist!", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end



it creates a new section in an ini file if it does not already exist (sad that ther is no actoin for that in the INI section)
the first time it works but if i push the button a 2nd time i get this error message

attempt to index a string value
but why? i tried to empty the table and the variables but it did not change anything :(


btw: if i add \n or \r to a string i dont have a new line in the textfiles i write. how can i add a new line with the write textfile command?

hope someone knows the answer, thx in advance! :)

Stefan_M
12-20-2003, 09:36 PM
Hi,

try the following code.
I didn't find out why your problem exists but I know a solution for you.


DATA_Sections = INIFile.GetSectionNames(_SourceFolder.."\\DATA.ini");
-- Namen der neuen Kategorie abfragen
NewCatName = Dialog.Input("Enter name of new Category", "Category Name:", "", MB_ICONQUESTION);
-- Prüfen ob die Kategorie schon existiert
CatSearchResult= false;
for count in DATA_Sections do
if (DATA_Sections[count]==NewCatName) then
CatSearchResult = true
else
CatSearchResult = false
end
end
if (CatSearchResult == false) then
string = "\["..NewCatName.."\]";
TextFile.WriteFromString(_SourceFolder.."\\DATA.ini", "\r\n", true);
TextFile.WriteFromString(_SourceFolder.."\\DATA.ini", string, true);
else
result = Dialog.Message("Error", "This Category Name does already exist!", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end




Greatings from Salzburg/Austria
Stefan

SonG0han
12-22-2003, 12:49 PM
thanks, i will try that! :)
i already thought about using the "for x in table do" method but i thought it would be easier to make a delimited string out of the table, its less to code

but why does it not work with a del. list of the tablecontents? anyone knows? :confused:

SonG0han
12-22-2003, 01:36 PM
hello again.
i didnt test it in the app where i needed the code yet but i used it in another project and think i found a little "error" in it.

for count in DATA_Sections do
if (DATA_Sections[count]==NewCatName) then
CatSearchResult = true
else
CatSearchResult = false
end
end

could it be that this doesnt work?
for every entry the code between do and end is evulated, right? so if its true at the first entry it will get false if it reaches the last? -> so everytime only the last entry counts - right or not? :confused:

Below you find the code of my "Add to Favorites" function. it adds an entry to a INI file and checks if it is already present. i used BREAK to exit if the result is TRUE - its true when it is already in the file and then it should not add it again.

if you have some time I would be very happy about suggestions or tips to improve the code but as far as I can see it works. :)

-- AddToFavorites Function
function AddToFavorites()
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
-- Prüfen ob der Name schon in der INI vorhanden ist! (groß-/klein muß egal sein!)
--> INI einlesen und nach dem neuen Eintrag suchen:
tblFavoritesNames = {};
tblFavoritesNamesCount = Table.Count(tblFavoritesNames);
if tblFavoritesNamesCount > 0 then
Count = 1;
while Count <= tblFavoritesNamesCount do
Table.Remove(tblFavoritesNames, Count);
Count = Count + 1
end
end
tblFavoritesNames = INIFile.GetValueNames(_SourceFolder.."\\Settings.ini", "Favorites");

SearchResult = false;
for count in tblFavoritesNames do
if (String.Lower(tblFavoritesNames[count]) == String.Lower(CurrentURLName)) then
SearchResult = true
break
else
SearchResult = false
end
end
if (SearchResult == false) then
ListBox.AddItem("Favorites", CurrentURLName, CurrentURL);
INIFile.SetValue(_SourceFolder.."\\Settings.ini", "Favorites", CurrentURLName, CurrentURL);
else
Dialog.Message("Error", "An entry with this name does alredy exist!\nPlease chose another name.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end
end
end

NOTE: if I dont delete the tableentries it doesnt seem to work. so you have to delete the table entries every time?

bye *waves*

SonG0han
12-22-2003, 02:01 PM
hmm i got some errors if there are no entries and I tried to prevent this and added some new lines of code but now it lets me only add 1 entry if the favorites section in the ini is empty.

i dont get any error messages. I try to find the problem but I hope someone can help me and give me a tip ;)


new code (i belive it could be much better)

-- AddToFavorites Function
function AddToFavorites()
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
-- Prüfen ob der Name schon in der INI vorhanden ist! (groß-/klein muß egal sein!)
--> INI einlesen und nach dem neuen Eintrag suchen:
tblFavoritesNames = {};
tblFavoritesNamesCount = 0;
tblFavoritesNamesCount = Table.Count(tblFavoritesNames);
if tblFavoritesNamesCount > 0 then
Count = 1;
while Count <= tblFavoritesNamesCount do
Table.Remove(tblFavoritesNames, Count);
Count = Count + 1
end
end
tblFavoritesNames = INIFile.GetValueNames(_SourceFolder.."\\Settings.ini", "Favorites");

SearchResult = false;

if (tblFavoritesNames == nil) then
tblFavoritesNames = {};
end
tblFavoritesNamesCount = 0;
tblFavoritesNamesCount = Table.Count(tblFavoritesNames);

if (tblFavoritesNamesCount ~= 0) then
for count in tblFavoritesNames do
if (String.Lower(tblFavoritesNames[count]) == String.Lower(CurrentURLName)) then
SearchResult = true
break
else
SearchResult = false
end
end
else
if (SearchResult == false) then
ListBox.AddItem("Favorites", CurrentURLName, CurrentURL);
INIFile.SetValue(_SourceFolder.."\\Settings.ini", "Favorites", CurrentURLName, CurrentURL);
else
Dialog.Message("Error", "An entry with this name does alredy exist!\nPlease chose another name.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end
end

end
end

Stefan_M
12-23-2003, 12:55 AM
Hi,

I didn't test it so there was an error.


for count in DATA_Sections do
if (DATA_Sections[count]==NewCatName) then
CatSearchResult = true
else
CatSearchResult = false
end
end


Change it to

CatSearchResult = false;
for count in DATA_Sections do
if (DATA_Sections[count]==NewCatName) then
CatSearchResult = true;
end
end


you do not need the "else" part

Stefan

SonG0han
12-31-2003, 03:12 AM
thanks :)

any other suggestions for the code above? :rolleyes:

Stefan_M
12-31-2003, 08:07 AM
Hi SonG0han,

try the following solution.

Stefan