View Full Version : StatusDlg.SetTitle
Jason Pate
10-09-2004, 06:53 PM
I am doing a File.Copy and displaying the statusDlg is nice but I want to set the title. From best I can get, I need to create a function and call that function to do that. (if that is wrong please correct me) Problem is when I call the function I loose the rest of the statusdlg display info, aka the
Copy to info was nice, and I also loose the progress of the file copy, I am copying enough that the progress of the file copy info nice to display the users. I have tired setting some of the other options but with no luck.
If someone has a working example that would be great or if you can point out what’s wrong with my code.
cliniccount="clinic count"
clinicname="clinic name"
clinicname = Dialog.Input(clinicname.." ".."1 of "..cliniccount.." ".."Is entered next Please enter the next Clinic", "Clinic Name", "", MB_ICONQUESTION)
function copydisplay()
StatusDlg.SetTitle("SetTitle..Installing"..clinicname);
return
end
Folder.DeleteTree("C:\\test\\junk")
Folder.Create("C:\\test")
Folder.Create("C:\\test\\junk")
appfolder="C:\\test\\junk"
StatusDlg.Show(MB_ICONNONE, false)
File.Copy("C:\\test\\*.*", appfolder, true, true, false, true, copydisplay)
Lorne
10-12-2004, 09:51 AM
I don't think you need a callback function to set the title bar...just do this:
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.SetTitle("Installing"..clinicname);
File.Copy("C:\\test\\*.*", appfolder, true, true, false, true, nil)
As for why your callback function wasn't working...you're accessing a global variable from inside the callback function; that value isn't going to change as the file is copied. The progress information is sent to the callback function via parameters, and when you use a callback function you have to do things like set the progress bar and all that using actions. In other words, if you want to replace the default status dialog, you need to replace its functionality. (As much or as little as you want.) It's designed so that you can display the progress information in any way you want -- or even choose not to display it and just track it internally for some purpose.
function copydisplay(strSource, strDestination, nCopied, nTotal)
-- put actions in here to display the progress how you want
return;
end
But if all you want to do is set the title of the built-in status dialog, just use StatusDlg.SetTitle before you call File.Copy.
Jason Pate
10-12-2004, 04:37 PM
function filecopy()
--INIFile.GetValue(SessionVar.Expand("%AppFolder%\\settings.ini"), count, Clinic)
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.SetTitle("Installing"..clinicname);
File.Copy(SessionVar.Expand("%AppFolder%\\*.*"), appfolder, true, true, false, true, nil)--funfilecopydisplay
end
I am calling this as a function under the resorces menu. But each time I run it the title is still Copying.
Lorne
10-12-2004, 04:57 PM
Try this instead:
function filecopy()
--INIFile.GetValue(SessionVar.Expand("%AppFolder%\\settings.ini"), count, Clinic)
StatusDlg.SetTitle("Installing"..clinicname);
StatusDlg.Show(MB_ICONNONE, false);
File.Copy(SessionVar.Expand("%AppFolder%\\*.*"), appfolder, true, true, false, true, nil); --funfilecopydisplay
end
Jason Pate
10-12-2004, 05:20 PM
No luck I am starting to feel like this is a BUG of some kind. I tried ALL weekend every different way I could to change this with no luck of getting it right at all.
If I get the title changes I loose the progress bar and everything else and that is inconstant. I do appericate your help. any idea's?
function regsettings ()
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ReDoc Software\\"..clinicname, "clinicname", clinicname)
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ReDoc Software\\"..clinicname, "appfolder", appfolder)
Shell.CreateShortcut(_DesktopFolder, clinicname, msaccesspath, cmdline, appfolder..clinicname, appfolder.."\\ReDoc.ico", 0, SW_MAXIMIZE, nil, "This is the comment");
--Shell.CreateShortcut(_DesktopFolder, clinicname, msaccesspath, cmdline, SessionVar.Expand("%AppFolder%").."\\"..clinicname, SessionVar.Expand("%AppFolder%").."\\"..clinicname.."\\ReDoc.ico", 0, SW_MAXIMIZE, nil, "This is the comment");
end
function filecopy()
--INIFile.GetValue(SessionVar.Expand("%AppFolder%\\settings.ini"), count, Clinic)
StatusDlg.SetTitle("Installing"..clinicname);
StatusDlg.Show(MB_ICONNONE, false);
File.Copy(SessionVar.Expand("%AppFolder%\\*.*"), appfolder, true, true, false, true, nil)--funfilecopydisplay
end
Hi Jason,
This is actually by design, it was designed this way to make the process as simple as possible.
What is happening is because you are showing the Status Dialog and then running File.Copy() without the callback, Setup Factory is taking control of the status dialog and setting all text to appropriate values for the operation.
Setup Factory is setting the title of the dialog to be the localized string: MSG_COPYING
If you want to customize the title of the status dialog try something like the following code:
--Get the Localized string to set it back later
strLocString = SetupData.GetLocalizedString("MSG_COPYING");
--Change the localized string to your title
SetupData.SetLocalizedString("MSG_COPYING","Installing"..clinicname);
StatusDlg.Show(MB_ICONNONE, false);
File.Copy(SessionVar.Expand("%AppFolder%\\*.*"), appfolder, true, true, false, true, nil);
--Reset the localized string
SetupData.SetLocalizedString("MSG_COPYING",strLocString);
Also, if you were to use a callback function to override the default text, you would have to set the progress and other options on the Status Dialog yourself.
Lorne
10-13-2004, 02:19 PM
Sorry Jason, I was wrong...in order to change the title like that, you'll need to use a callback function or temporarily change the message string like Mark suggested.
There must be a difference between the SF7 in my head and the SF7 that actually exists. :)
Sorry about that.
Jason Pate
10-13-2004, 03:58 PM
Mark,
Thank you that worked!!! And its totally what I have been looking for.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.