%-----------------------------------------------------------------------
%
%      Zimprof: Start the Example Application.
%
%-----------------------------------------------------------------------

%----------------------- plInitExample --------------------------------

localprocedure plInitExample()

output "======================================================================'"
output "         Zim Technologies International Inc.  "
output "       Example Application Set up Instructions"
output ""
output "======================================================================"
output ""
output "To create the Example Application, follow these steps:"
output ""
output "1. Enter DC."
output "2. From the TOOLS menu, select IMPORT, IMPORT WIZARD."
output "   The object dictionary definitions and data will be imported"
output "   from files in the 'Port' directory."
output "3. Click the FINISH button."
output "4. From the TOOLS, OBJECT MANAGER menu, select MAKE."
output "   The MAKE command will touch all objects and compile all programs."
output "5. Exit DC."
output "6. Execute START. The Application window will open."
output ""
output "======================================================================"
output ""

endprocedure

%----------------------- plExitDialog ---------------------------------

localprocedure plExitDialog()   \
   local (vlAction)

% Start the application.
   set information off
   Example$ADE()

% On exit, give user option of restarting the application, starting DC,
% accessing a command prompt, or exiting from Zim.
   while
      window open wExitDialog at center
      window set accelerator Escape
      form open fExitDialog
      form display input
      let vlAction = Event.EventTag
      window close wExitDialog

      case
      when vlAction = "DC"       % Start the Development Center.
         if $iswinopen ("wDevCen") = $true
            return
         endif
         DC
      when vlAction = "PROMPT"    % Exit to command prompt.
         clear
         output 'Enter "START" to re-start the Example Application.'
         if $iswinopen ('wDevCen') = $false
            output 'Enter "DC" to start the Development Center.'
         endif
         output 'Enter "BYE" to exit from Zim.'
         return
      when vlAction = "EXIT"      % Leave Zim.
         bye
      otherwise                   % Re-start the Example Application.
         Example$ADE()
      endcase
   endwhile
endprocedure

%--------------------------- Zimprof -------------------------------

screen clear
set color on

% Start the application.
compute 1 Documents where DocName = 'Start' evaluate ('')
if $membercount=1
    plExitDialog()
else
    plInitExample()
endif
