PDA

View Full Version : Progress Meter



azmanar
02-01-2006, 12:23 PM
Hi,

Is there any example of how to set a Progress Meter text?

It's for File.Copy : Title, From and To .

The default setting gives full File Path for FROM and TO. Meaning, leaving users to see something like this :
FROM : C:\.......\MyFile.doc
TO : C:\.......\Destination Folder

I just need to make it look like:
Copying [MyFile.doc] to Folder [Destination Folder]

Any help would be appreciated...

azmanar
02-01-2006, 12:43 PM
Hi,

Is there any example of how to set a Progress Meter text?



The request for help is for StatusDlg() function and not the Progress Plugin.

Anyone?

azmanar
02-01-2006, 11:34 PM
Anyone ........................?

yosik
02-02-2006, 12:19 AM
Hi,
While copying, the path that you get comes from either the "Source" string or the "Destination" string of your File.Copy action.
You can use the String.SplitPath action to create a table from your strings where the elements (Drive, path, filename and extensions) are separated. From there, it is easy to use the tblSpliteString.Filename (for example) to show the filename only.
Hope that helps.

Yossi

azmanar
02-02-2006, 12:31 AM
Hi,
While copying, the path that you get comes from either the "Source" string or the "Destination" string of your File.Copy action.
You can use the String.SplitPath action to create a table from your strings where the elements (Drive, path, filename and extensions) are separated. From there, it is easy to use the tblSpliteString.Filename (for example) to show the filename only.
Hope that helps.

Yossi

Thanks for responding, Yosik.

String.SplitPath was what I used. I tried to pass them variables using StatusDlg.SetTitleText and StatusDlg.SetText for contents, but it won't work. I missed something and couldnt figure it out.

An example is greatly needed.

yosik
02-02-2006, 12:34 AM
No time to do it now, but could you post your part of the project and I will try and look into it...
Yossi

azmanar
02-03-2006, 05:59 AM
No time to do it now, but could you post your part of the project and I will try and look into it...
Yossi

Yosik,

Thanks for extending a helping hand.

Here's the code I have problem with:


tSelected = ListBox.GetSelected(LB);

-- because we are not allowing multiple select in the
-- ListBox object, we are only concerned with tSelected[1]

-- ensure that there is something selected in the ListBox
if tSelected then
-- there is an item selected
sFilePath = ListBox.GetItemData(LB, tSelected[1]);
proceed = Dialog.Message("Notice", "DO YOU WANT TO COPY :\r\n"..sFilePath, MB_OKCANCEL, MB_ICONINFORMATION, MB_DEFBUTTON1);
tFileParts = String.SplitPath (sFilePath);
sFileName = tFileParts.Filename..tFileParts.Extension;
if proceed ~= IDCANCEL then
sDestinationFolder = Dialog.FolderBrowse("Please Select the Destination Folder", _DesktopFolder)
if sFolder ~= "CANCEL" then
--copy the file to the folder
StatusDlg.SetTitle("Copying File...");
StatusDlg.SetStatusText("Copying file : "..sFileName.."to Folder : "..sDestinationFolder);
StatusDlg.ShowProgressMeter(true);
StatusDlg.Show();
File.Copy(sFilePath, sDestinationFolder, false, true, true, false, nil)
-- Check to see if the File.Copy action failed by getting it's error code.
error = Application.GetLastError();
StatusDlg.Hide();

-- If it failed (not equal to 0), display a dialog informing the user.
-- If it succeeded, open an explore window showing the "Copied Files" folder.
if error ~= 0 then
result = Dialog.Message("Error", "There was an error copying the files to your system. Please try again.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
else
Shell.Execute(sDestinationFolder, "explore", "", "", SW_SHOWNORMAL);
end

end

end

else
-- Display an error message
Dialog.Message("Error", "There is no item selected.");
end

azmanar
02-03-2006, 06:53 AM
Yosik,

Ok...I go it to work finally. I reassigned those lines into a function and set the function name into the File.Copy callback attribute ( previously NIL ).

BUT....my not very long text got cut-off, so had to use the \r\n instead, which not the way that I like it to be.

Can we set the SIZE of the Pop-Up Screen of the Progress Meter in terms of width ( length ) ?

yosik
02-03-2006, 07:19 AM
What about the StatusDlg.SetAutoSize?

Yossi

azmanar
02-03-2006, 08:11 AM
What about the StatusDlg.SetAutoSize?

Yossi

I missed this function. Now it works.

Thanks Yossi