Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2017
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. &ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI
  2. &ANALYZE-RESUME
  3. &Scoped-define WINDOW-NAME C-Win
  4. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS C-Win
  5. /*------------------------------------------------------------------------
  6.  
  7.   File:
  8.  
  9.   Description:
  10.  
  11.   Input Parameters:
  12.       <none>
  13.  
  14.   Output Parameters:
  15.       <none>
  16.  
  17.   Author:
  18.  
  19.   Created:
  20.  
  21. ------------------------------------------------------------------------*/
  22. /*          This .W file was created with the Progress AppBuilder.      */
  23. /*----------------------------------------------------------------------*/
  24.  
  25. /* Create an unnamed pool to store all the widgets created
  26.      by this procedure. This is a good default which assures
  27.      that this procedure's triggers and internal procedures
  28.      will execute in this procedure's storage, and that proper
  29.      cleanup will occur on deletion of the procedure. */
  30.  
  31. CREATE WIDGET-POOL.
  32.  
  33. /* ***************************  Definitions  ************************** */
  34.  
  35. /* Parameters Definitions ---                                           */
  36.  
  37. /* Local Variable Definitions ---                                       */
  38.  
  39. /* _UIB-CODE-BLOCK-END */
  40. &ANALYZE-RESUME
  41.  
  42.  
  43. &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
  44.  
  45. /* ********************  Preprocessor Definitions  ******************** */
  46.  
  47. &Scoped-define PROCEDURE-TYPE WINDOW
  48. &Scoped-define DB-AWARE no
  49.  
  50. /* Name of first Frame and/or Browse and/or first Query                 */
  51. &Scoped-define FRAME-NAME DEFAULT-FRAME
  52.  
  53. /* Standard List Definitions                                            */
  54. &Scoped-Define ENABLED-OBJECTS BtnOK
  55.  
  56. /* Custom List Definitions                                              */
  57. /* List-1,List-2,List-3,List-4,List-5,List-6                            */
  58.  
  59. /* _UIB-PREPROCESSOR-BLOCK-END */
  60. &ANALYZE-RESUME
  61.  
  62.  
  63.  
  64. /* ***********************  Control Definitions  ********************** */
  65.  
  66. /* Define the widget handle for the window                              */
  67. DEFINE VAR C-Win AS WIDGET-HANDLE NO-UNDO.
  68.  
  69. /* Definitions of the field level widgets                               */
  70. DEFINE BUTTON BtnOK AUTO-GO DEFAULT
  71.      LABEL "OK"
  72.      SIZE-PIXELS 75 BY 24
  73.      BGCOLOR 8 .
  74.  
  75.  
  76. /* ************************  Frame Definitions  *********************** */
  77.  
  78. DEFINE FRAME DEFAULT-FRAME
  79.      BtnOK AT Y 130 X 160 WIDGET-ID 48
  80.     WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
  81.          SIDE-LABELS NO-UNDERLINE THREE-D
  82.          AT COL 1 ROW 1
  83.          SIZE 80 BY 16 WIDGET-ID 100.
  84.  
  85.  
  86. /* *********************** Procedure Settings ************************ */
  87.  
  88. &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
  89. /* Settings for THIS-PROCEDURE
  90.    Type: Window
  91.    Allow: Basic,Browse,DB-Fields,Window,Query
  92.    Other Settings: COMPILE
  93.  */
  94. &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
  95.  
  96. /* *************************  Create Window  ************************** */
  97.  
  98. &ANALYZE-SUSPEND _CREATE-WINDOW
  99. IF SESSION:DISPLAY-TYPE = "GUI":U THEN
  100.   CREATE WINDOW C-Win ASSIGN
  101.          HIDDEN             = YES
  102.          TITLE              = "<insert window title>"
  103.          HEIGHT             = 16
  104.          WIDTH              = 80
  105.          MAX-HEIGHT         = 16
  106.          MAX-WIDTH          = 80
  107.          VIRTUAL-HEIGHT     = 16
  108.          VIRTUAL-WIDTH      = 80
  109.          RESIZE             = yes
  110.          SCROLL-BARS        = no
  111.          STATUS-AREA        = no
  112.          BGCOLOR            = ?
  113.          FGCOLOR            = ?
  114.          KEEP-FRAME-Z-ORDER = yes
  115.          THREE-D            = yes
  116.          MESSAGE-AREA       = no
  117.          SENSITIVE          = yes.
  118. ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
  119. /* END WINDOW DEFINITION                                                */
  120. &ANALYZE-RESUME
  121.  
  122.  
  123.  
  124. /* ***********  Runtime Attributes and AppBuilder Settings  *********** */
  125.  
  126. &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
  127. /* SETTINGS FOR WINDOW C-Win
  128.   VISIBLE,,RUN-PERSISTENT                                               */
  129. /* SETTINGS FOR FRAME DEFAULT-FRAME
  130.                                                                         */
  131. IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(C-Win)
  132. THEN C-Win:HIDDEN = no.
  133.  
  134. /* _RUN-TIME-ATTRIBUTES-END */
  135. &ANALYZE-RESUME
  136.  
  137.  
  138.  
  139.  
  140.  
  141. /* ************************  Control Triggers  ************************ */
  142.  
  143. &Scoped-define SELF-NAME C-Win
  144. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL C-Win C-Win
  145. ON END-ERROR OF C-Win /* <insert window title> */
  146. OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
  147.   /* This case occurs when the user presses the "Esc" key.
  148.      In a persistently run window, just ignore this.  If we did not, the
  149.      application would exit. */
  150.   APPLY 'close' TO THIS-PROCEDURE.
  151.   /* IF THIS-PROCEDURE:PERSISTENT THEN RETURN NO-APPLY. */
  152. END.
  153.  
  154. /* _UIB-CODE-BLOCK-END */
  155. &ANALYZE-RESUME
  156.  
  157.  
  158. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL C-Win C-Win
  159. ON WINDOW-CLOSE OF C-Win /* <insert window title> */
  160. DO:
  161.   /* This event will close the window and terminate the procedure.  */
  162.   APPLY "CLOSE":U TO THIS-PROCEDURE.
  163.   RETURN NO-APPLY.
  164. END.
  165.  
  166. /* _UIB-CODE-BLOCK-END */
  167. &ANALYZE-RESUME
  168.  
  169.  
  170. &Scoped-define SELF-NAME DEFAULT-FRAME
  171. &Scoped-define SELF-NAME BtnOK
  172. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL BtnOK C-Win
  173. ON CHOOSE OF BtnOK IN FRAME DEFAULT-FRAME /* OK */
  174. DO:
  175.   ETIME(YES).
  176.  
  177.   REPEAT WHILE ETIME < 4000:
  178.     PROCESS EVENTS.
  179.   END.
  180.  
  181. END.
  182.  
  183. /* _UIB-CODE-BLOCK-END */
  184. &ANALYZE-RESUME
  185.  
  186.  
  187. &UNDEFINE SELF-NAME
  188.  
  189. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK C-Win
  190.  
  191.  
  192. /* ***************************  Main Block  *************************** */
  193.  
  194. /* Set CURRENT-WINDOW: this will parent dialog-boxes and frames.        */
  195. ASSIGN CURRENT-WINDOW                = {&WINDOW-NAME}
  196.        THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.
  197.  
  198. /* The CLOSE event can be used from inside or outside the procedure to  */
  199. /* terminate it.                                                        */
  200. ON CLOSE OF THIS-PROCEDURE
  201.    RUN disable_UI.
  202.  
  203. /* Best default for GUI applications is...                              */
  204. PAUSE 0 BEFORE-HIDE.
  205.  
  206. /* Now enable the interface and wait for the exit condition.            */
  207. /* (NOTE: handle ERROR and END-KEY so cleanup code will always fire.    */
  208. MAIN-BLOCK:
  209. DO ON ERROR   UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
  210.    ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
  211.  
  212.   RUN enable_UI.
  213.  
  214.   IF NOT THIS-PROCEDURE:PERSISTENT THEN
  215.     WAIT-FOR CLOSE OF THIS-PROCEDURE.
  216. END.
  217.  
  218. /* _UIB-CODE-BLOCK-END */
  219. &ANALYZE-RESUME
  220.  
  221.  
  222. /* **********************  Internal Procedures  *********************** */
  223.  
  224. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI C-Win  _DEFAULT-DISABLE
  225. PROCEDURE disable_UI :
  226. /*------------------------------------------------------------------------------
  227.   Purpose:     DISABLE the User Interface
  228.   Parameters:  <none>
  229.   Notes:       Here we clean-up the user-interface by deleting
  230.                dynamic widgets we have created and/or hide
  231.                frames.  This procedure is usually called when
  232.                we are ready to "clean-up" after running.
  233. ------------------------------------------------------------------------------*/
  234.   /* Delete the WINDOW we created */
  235.   IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(C-Win)
  236.   THEN DELETE WIDGET C-Win.
  237.   IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
  238. END PROCEDURE.
  239.  
  240. /* _UIB-CODE-BLOCK-END */
  241. &ANALYZE-RESUME
  242.  
  243. &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI C-Win  _DEFAULT-ENABLE
  244. PROCEDURE enable_UI :
  245. /*------------------------------------------------------------------------------
  246.   Purpose:     ENABLE the User Interface
  247.   Parameters:  <none>
  248.   Notes:       Here we display/view/enable the widgets in the
  249.                user-interface.  In addition, OPEN all queries
  250.                associated with each FRAME and BROWSE.
  251.                These statements here are based on the "Other
  252.                Settings" section of the widget Property Sheets.
  253. ------------------------------------------------------------------------------*/
  254.   ENABLE BtnOK
  255.       WITH FRAME DEFAULT-FRAME IN WINDOW C-Win.
  256.   {&OPEN-BROWSERS-IN-QUERY-DEFAULT-FRAME}
  257.   VIEW C-Win.
  258. END PROCEDURE.
  259.  
  260. /* _UIB-CODE-BLOCK-END */
  261. &ANALYZE-RESUME
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement