PDA

View Full Version : Displaying a 'Please wait' message



DJG
01-17-2005, 06:24 PM
Setup factory 7 is wonderful but I have a deadline and need to do this:-
Display a message that says 'Please wait while I search' (no user action is required) - I then do a file.find and hide the message after the file is found.
Right now I can only have screen text that says 'click the next button and wait for the system to find the file'.
Any other fast solutions would also be gratefully received. I have 8 hours to get this app out.

Ted Sullivan
01-17-2005, 10:38 PM
No problem. Use StatusDlg.Show (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/StatusDlg.Show_Examples.htm) and StatusDlg.Hide (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/StatusDlg.Hide.htm) to do exactly that. Check out the links for a full example.

Intrigued
01-17-2005, 11:51 PM
To add to Ted's suggestion I went ahead and crafted a simple Function that you can edit by going into the Global Functions section.

Here is the Global Functions code:



--[[
This is a function that will search for a file.
When call this function, change out sFile to the...
path to the file you want to check for. Make sure...
such is wrapped in double-quotes ("") and each directory...
is seperated by TWO BACKSLASHES!
For example: fFILESEARCH("\\WINDOWS\\notepad.exe")
Then put that line of text in say the 'On Startup' event
]]

function fFILESEARCH(sFile)
StatusDlg.Show(true);
StatusDlg.SetMessage("Please wait while I search...");

found = File.Find(_SourceDrive, sFile, false);

if (found) then
StatusDlg.Hide();
Dialog.TimedMessage("Notice...", "File found.", 3000, MB_ICONINFORMATION);
else
StatusDlg.Hide();
Dialog.TimedMessage("Alert!", "FILE NOT FOUND!", 3000, MB_ICONEXCLAMATION);
end
end


The Function is then called in the On Startup event area:



--[[
Call the Function that was created in the...
Global Functions section
]]

fFILESEARCH("\\WINDOWS\\notepad.exe");


SEE: Attachment (for .sf7 project file)

Please note: That the file being checked for is notepade.exe (which works for Windows XP as the code is now. Your milage may vary).

DJG
01-18-2005, 05:27 AM
Thanks for that chaps, but showing the StatusDlg displays all the files being searched with the window expanding and contracting for long path names. It also takes considerably longer like this. Is there any way to display the message without all the filenames appearing.

Thanks

DJG
01-18-2005, 06:04 AM
OR - can I just change the static text on the screen. I know there is a 'Screen.SetLocalizedString("Text ID","My Text");' command but I can't see where the text ID is - perhaps it can't be changed.

Brett
01-18-2005, 08:28 AM
Use a Progress Bars screen. Go to the On Start event and start your file search. The On Finish event should already have the Screen.Next command to proceed. To set static text, use the action:


DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 01,{Text="Please wait..."});

Intrigued
01-18-2005, 09:23 AM
Use a Progress Bars screen. Go to the On Start event and start your file search. The On Finish event should already have the Screen.Next command to proceed. To set static text, use the action:


DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 01,{Text="Please wait..."});

I tried this after I posted with a bigger search area... and noticed the dialog box expanding and contracting too. Yikes!

Now, I'll have to try Brett's idea out myself, alright!

Learning SF 7 or bust!

DJG
01-18-2005, 12:51 PM
Use a Progress Bars screen. Go to the On Start event and start your file search. The On Finish event should already have the Screen.Next command to proceed. To set static text, use the action:


DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 01,{Text="Please wait..."});

I tried this - it didn't work but CTRL_STATICTEXT_BODY did, but not until after I sent out the app.

I'll look at progress bars next BUT - where do I find these constants such as CTRL_STATICTEXT_BODY.
The help file says:

ControlID
(number) The numeric ID of the static text control whose properties you want to set.

I checked everything in the static text window but nowhere could I find the list of constants. This I find particularly infuriating and time consuming. Perhaps I'm missing something!

Any ideas?

Brett
01-18-2005, 01:22 PM
The descriptions of the screen control IDs are in the Help file. Open the SUF70 help file and in the Contents tree go to:

Programming Reference > Screen Types

Then click on the screen type that you are working with and then open the Adnaced topic for that screen.

DJG
01-18-2005, 05:03 PM
Thanks Brett,

I too have written huge help files for my application and although I know where to find everything, my clients probably have the same problems as I have knowing what to look for.

I'm using a progress bars screen with my code in the ON START section.

I think I've nearly cracked this - can you bear one more question. in file.find, my callback function is not being called. I've set up a debug window to display a 'hello world' from within the function but it never displays.

Snippet:

for j,k in result do
what_type = Drive.GetType(k)
if what_type == DRIVE_FIXED then
found = File.Find(k, "*rotaquest.exe", true, false, MYshowprogress, nil);
............

The function name is the same case - here it is:-

function MYshowprogress(cPath)
nPos = DlgProgressBar.GetPos(CTRL_PROGRESS_BAR_01);
Debug.Print("Pos = ".. nPos);
Debug.Print(cPath);
if npos >= 100 then
DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_01,1);
else
DlgProgressBar.Step (CTRL_PROGRESS_BAR_01)
end
return true
end


If I can solve this then I'll be leaping over the moon.

DJG

DJG
01-21-2005, 04:22 AM
I've now got this working by putting the callback function before the file.find.
Also, I found a case-different variable (e.g. nPos and npos) and missing ;
:rolleyes

Intrigued
01-21-2005, 12:55 PM
I understand the case-sensitive issue myself. I bet we all do. It can be a real pain to track down such a type of error. I probable do this once every other project.