home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / COMMERC_72_53OLD / PROGS / MyAppSys.prg < prev    next >
Text File  |  2014-04-02  |  3KB  |  106 lines

  1. //////////////////////////////////////////////////////////////////////
  2. //
  3. //  APPSYS.PRG
  4. //
  5. //  Copyright:
  6. //      Alaska Software, (c) 1997-2002. All rights reserved.         
  7. //  
  8. //  Contents:
  9. //      AppSys() - Creates default application window
  10. //   
  11. //  Remarks:
  12. //      This file is part of the XppRt0.lib.
  13. //   
  14. //  Syntax:
  15. //      The function AppSys() is called automatically during 
  16. //      the programm startup.
  17. //   
  18. //////////////////////////////////////////////////////////////////////
  19.  
  20. #include "xbp.ch"
  21.  
  22. ****************************************************************************
  23. * Function AppSys() to create default output devices
  24. ****************************************************************************
  25. PROCEDURE AppSys()
  26.  
  27. #define DEF_ROWS       25
  28. #define DEF_COLS       80
  29. *#define DEF_FONTHEIGHT 22
  30. *#define DEF_FONTWIDTH  12
  31.  
  32.   LOCAL oCrt, nAppType := AppType()
  33.   LOCAL aSizeDesktop, aPos
  34.   LOCAL DEF_FONTHEIGHT:= 16
  35.   LOCAL DEF_FONTWIDTH:=  8
  36.  
  37.   DO CASE 
  38.  
  39.     // PM Mode: create an XbpCrt instance
  40.     CASE nAppType == APPTYPE_PM
  41.  
  42.       // Compute window position (center window 
  43.       // on the Desktop)
  44.       aSizeDesktop    := AppDesktop():currentSize()
  45.  
  46.       IF aSizeDesktop[1] > 800
  47.          DEF_FONTHEIGHT:= 22
  48.          DEF_FONTWIDTH:=  12
  49.       ENDIF          
  50.  
  51.       aPos            := { (aSizeDesktop[1]-(DEF_COLS * DEF_FONTWIDTH))  /2, ;
  52.                            (aSizeDesktop[2]-(DEF_ROWS * DEF_FONTHEIGHT)) /2  }
  53.  
  54.       // Create XbpCRT object
  55.       oCrt := XbpCrt():New ( NIL, NIL, aPos, DEF_ROWS, DEF_COLS )
  56.       oCrt:FontWidth  := DEF_FONTWIDTH
  57.       oCrt:FontHeight := DEF_FONTHEIGHT
  58.       oCrt:title      := AppName()
  59. #ifdef __OS2__
  60.       oCrt:FontName   := "System VIO"
  61. #endif
  62. #ifdef __WIN32__
  63.       IF aSizeDesktop[1] <= 800
  64.          oCrt:FontName   := "Alaska Crt"
  65.       ELSE 
  66.          oCrt:FontName   := "Lucida Console"
  67.       ENDIF   
  68. #endif
  69.       oCrt:Create()
  70.  
  71.       // Init Presentation Space
  72.       oCrt:PresSpace()
  73.  
  74.       // XbpCrt gets active window and output device
  75.       SetAppWindow ( oCrt )
  76.  
  77.     // VIO or NOVIO Mode: create a RootCrt instance
  78.     CASE nAppType == APPTYPE_VIO .OR. nAppType == APPTYPE_NOVIO
  79.  
  80.       // Create RootCrt object
  81.       //
  82.       // The IVar :CreateBuffer determines the behaviour of the RootCrt
  83.       // when it is created in a shell window.
  84.       //
  85.       //   :CreateBuffer == .T. : The RootCrt will create a new
  86.       //                          screen buffer with the same size
  87.       //                          as the console window. This causes
  88.       //                          the effect that outputs with
  89.       //                          OutStd() or printf() wont be
  90.       //                          displayed.
  91.       //   :CreateBuffer == .F. : The RootCrt will use the screen 
  92.       //                          buffer of the window where it runs
  93.       //                          in.
  94.       oCrt := RootCrt():New()
  95.       oCrt:CreateBuffer := .T.
  96.       oCrt:Create()
  97.  
  98.       // RootCrt gets active window and output device
  99.       SetAppWindow ( oCrt )
  100.  
  101.   ENDCASE
  102.  
  103. RETURN
  104.  
  105. // EOF
  106.