SonG0han
06-21-2004, 09:31 AM
k.. again now :|
this is a shortened version
i want to have 2 bars to show the unzip/install progress. one for current file and one for overall. but in the help it says for callback the "string" gives you the current filename and path but bevore every file it gives you "item x of y". thats missing in the helpfile ;)
if i try to remove this it does not work or if i try to set text to a paragraph i get an error at calling the callback function. is it a bug that you cant set paragraphs and labels in a callabackfuntion?
this is on show (old parts are partially commented)
-- SHOW DEBUG
Debug.SetTraceMode(true);
Debug.ShowWindow(true);
-- SHOW PROGRESS START
Page.StartTimer(350);
Progress.SetText("FILE", "Preparing Installation... Please wait...");
-- Get Contents of ZIP
tblZIP = Zip.GetContents(_SourceFolder.."\\DATA\\setup.zip", true);
-- Count Items of ZIP
ZipCount = Table.Count(tblZIP);
-- Set Overall Bar Range to ZIP Itemcount
Progress.SetRange("OVERALL", 0, ZipCount);
-- SHOW PROGRESS Finish --
Page.StopTimer();
Progress.SetText("FILE", "");
Progress.SetCurrentPos("FILE", 0);
-- SHOW PROGRESS END --
DEBUG = Dialog.Message("DEBUG", "ZipCount: "..ZipCount, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
StringCheck = 0;
-- Set Overall to 0
nOVERALL = 1;
-- Unzip and show details
Zip.Extract(_SourceFolder.."\\DATA\\setup.zip", {"*.*"}, FINALPATH, true, true, "", ZIP_OVERWRITE_ALWAYS, UnzipStatus);
Thats the Callback function for unzipping
function UnzipStatus (String, Percent)
--DEBUG = Dialog.Message("DEBUG", "String: "..String.."@ "..Percent.."%", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
--DEBUG = Dialog.Message("DEBUG", "Percent: "..Percent, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
-- Show Current Filename in Details-Box
--StringCheck = String.Find(String, FINALPATH, 1, false); FEHLER !?!?
--DEBUG = Dialog.Message("DEBUG", "StringCheck: "..StringCheck, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
if StringCheck >= 0 then
--sCurString = String.SplitPath(String);
--sDETAILS = Paragraph.GetText("parDetails");
--snewDETAILS = sDETAILS .. "\r\nExtracted: "..sCurString.Filename..sCurString.Extension
--Paragraph.SetText("parDetails", snewDETAILS);
end
--DEBUG = Dialog.Message("DEBUG", "Filename: "..sCurString, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
-- Increase File Bar (Percent)
if StringCheck >= 0 and Percent < 100 then
Progress.SetCurrentPos("FILE", Percent);
--return true;
end
-- Increase Overall Bar after each File
if StringCheck >= 0 and Percent == 100 then
nOVERALL = nOVERALL + 1;
Progress.SetCurrentPos("OVERALL", nOVERALL);
Progress.SetCurrentPos("FILE", 0);
--return true;
end
-- Stop when Overall = zip contents count
if nOVERALL == ZipCount then
return false;
else
return true;
end
end
this is a shortened version
i want to have 2 bars to show the unzip/install progress. one for current file and one for overall. but in the help it says for callback the "string" gives you the current filename and path but bevore every file it gives you "item x of y". thats missing in the helpfile ;)
if i try to remove this it does not work or if i try to set text to a paragraph i get an error at calling the callback function. is it a bug that you cant set paragraphs and labels in a callabackfuntion?
this is on show (old parts are partially commented)
-- SHOW DEBUG
Debug.SetTraceMode(true);
Debug.ShowWindow(true);
-- SHOW PROGRESS START
Page.StartTimer(350);
Progress.SetText("FILE", "Preparing Installation... Please wait...");
-- Get Contents of ZIP
tblZIP = Zip.GetContents(_SourceFolder.."\\DATA\\setup.zip", true);
-- Count Items of ZIP
ZipCount = Table.Count(tblZIP);
-- Set Overall Bar Range to ZIP Itemcount
Progress.SetRange("OVERALL", 0, ZipCount);
-- SHOW PROGRESS Finish --
Page.StopTimer();
Progress.SetText("FILE", "");
Progress.SetCurrentPos("FILE", 0);
-- SHOW PROGRESS END --
DEBUG = Dialog.Message("DEBUG", "ZipCount: "..ZipCount, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
StringCheck = 0;
-- Set Overall to 0
nOVERALL = 1;
-- Unzip and show details
Zip.Extract(_SourceFolder.."\\DATA\\setup.zip", {"*.*"}, FINALPATH, true, true, "", ZIP_OVERWRITE_ALWAYS, UnzipStatus);
Thats the Callback function for unzipping
function UnzipStatus (String, Percent)
--DEBUG = Dialog.Message("DEBUG", "String: "..String.."@ "..Percent.."%", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
--DEBUG = Dialog.Message("DEBUG", "Percent: "..Percent, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
-- Show Current Filename in Details-Box
--StringCheck = String.Find(String, FINALPATH, 1, false); FEHLER !?!?
--DEBUG = Dialog.Message("DEBUG", "StringCheck: "..StringCheck, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
if StringCheck >= 0 then
--sCurString = String.SplitPath(String);
--sDETAILS = Paragraph.GetText("parDetails");
--snewDETAILS = sDETAILS .. "\r\nExtracted: "..sCurString.Filename..sCurString.Extension
--Paragraph.SetText("parDetails", snewDETAILS);
end
--DEBUG = Dialog.Message("DEBUG", "Filename: "..sCurString, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
-- Increase File Bar (Percent)
if StringCheck >= 0 and Percent < 100 then
Progress.SetCurrentPos("FILE", Percent);
--return true;
end
-- Increase Overall Bar after each File
if StringCheck >= 0 and Percent == 100 then
nOVERALL = nOVERALL + 1;
Progress.SetCurrentPos("OVERALL", nOVERALL);
Progress.SetCurrentPos("FILE", 0);
--return true;
end
-- Stop when Overall = zip contents count
if nOVERALL == ZipCount then
return false;
else
return true;
end
end