1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI ADM1
3 &Scoped-define WINDOW-NAME W-ReportViewer
4 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS W-ReportViewer
5 /*------------------------------------------------------------------------
8 ------------------------------------------------------------------------*/
11 /* Local Variable Definitions
--- */
15 DEF VAR os-text-name
AS CHAR NO-UNDO.
16 DEF VAR os-ctrl-name
AS CHAR NO-UNDO.
18 DEF VAR save-directory
AS CHAR INITIAL "C:\" NO-UNDO.
19 DEF VAR search-text
AS CHAR NO-UNDO INITIAL "".
20 DEF VAR search-flags
AS INT NO-UNDO INITIAL 1.
22 DEF VAR window-w
AS INT NO-UNDO.
23 DEF VAR window-h
AS INT NO-UNDO.
25 DEF VAR display-font
AS INT INITIAL 28 NO-UNDO.
26 DEF VAR printout-font
AS INT INITIAL 29 NO-UNDO.
27 DEF VAR printout-dlg
AS LOGICAL INITIAL No
NO-UNDO.
28 DEF VAR printout-lscp
AS LOGICAL INITIAL No
NO-UNDO.
29 DEF VAR printout-w32
AS LOGICAL INITIAL No
NO-UNDO.
31 DEF VAR CURRENT-PRINTER-PORT
AS CHAR NO-UNDO.
33 DEF VAR user-name
AS CHAR NO-UNDO.
34 {inc
/username.i
"user-name"}
35 FIND RP
WHERE RP.UserName
= user-name
36 AND RP.ReportID
= "Report Viewer" NO-LOCK NO-ERROR.
38 /* _UIB-CODE-BLOCK-END
*/
42 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
44 /* ******************** Preprocessor Definitions
******************** */
46 &Scoped-define PROCEDURE-TYPE SmartWindow
47 &Scoped-define DB-AWARE no
49 &Scoped-define ADM-CONTAINER WINDOW
51 /* Name of first Frame and
/or Browse and
/or first Query
*/
52 &Scoped-define FRAME-NAME F-Main
54 /* Standard List Definitions
*/
55 &Scoped-Define ENABLED-OBJECTS ed-report
56 &Scoped-Define DISPLAYED-OBJECTS ed-report
58 /* Custom List Definitions
*/
59 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
61 /* _UIB-PREPROCESSOR-BLOCK-END
*/
66 /* *********************** Control Definitions
********************** */
68 /* Define the widget handle for the window
*/
69 DEFINE VAR W-ReportViewer
AS WIDGET-HANDLE NO-UNDO.
71 /* Menu Definitions
*/
72 DEFINE SUB-MENU m_File
73 MENU-ITEM m_Save
LABEL "&Save" ACCELERATOR "SHIFT-F12"
74 MENU-ITEM m_Print
LABEL "&Print" ACCELERATOR "CTRL-SHIFT-F12"
76 MENU-ITEM m_Save_Settings
LABEL "Save Se&ttings"
78 MENU-ITEM m_Exit
LABEL "E&xit" ACCELERATOR "CTRL-F4".
80 DEFINE SUB-MENU m_Edit
81 MENU-ITEM m_Copy
LABEL "&Copy" ACCELERATOR "CTRL-INS"
82 MENU-ITEM m_Select_All
LABEL "Select &All" ACCELERATOR "CTRL-A"
83 MENU-ITEM m_Display_Font
LABEL "Display Fo&nt" ACCELERATOR "ALT-CTRL-F"
84 MENU-ITEM m_Printout_Font
LABEL "&Printout Font" ACCELERATOR "ALT-CTRL-P"
85 MENU-ITEM m_Find
LABEL "&Find" ACCELERATOR "CTRL-F".
87 DEFINE SUB-MENU m_Help
88 MENU-ITEM m_Contents
LABEL "&Contents"
90 MENU-ITEM m_About
LABEL "&About" .
92 DEFINE MENU MENU-BAR-W-Win
MENUBAR
93 SUB-MENU m_File
LABEL "&File"
94 SUB-MENU m_Edit
LABEL "&Edit"
95 SUB-MENU m_Help
LABEL "&Help" .
98 /* Definitions of the field level widgets
*/
99 DEFINE VARIABLE ed-report
AS CHARACTER
100 VIEW-AS EDITOR NO-WORD-WRAP SCROLLBAR-HORIZONTAL SCROLLBAR-VERTICAL LARGE
105 /* ************************ Frame Definitions
*********************** */
108 ed-report
AT ROW 1 COL 1 NO-LABEL
109 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
110 SIDE-LABELS NO-UNDERLINE THREE-D
111 AT COL 1 ROW 1 SCROLLABLE .
114 /* *********************** Procedure Settings
************************ */
116 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
117 /* Settings for
THIS-PROCEDURE
119 Allow
: Basic
,Browse
,DB-Fields
,Query
,Smart
,Window
120 Other Settings
: COMPILE
122 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
124 /* ************************* Create Window
************************** */
126 &ANALYZE-SUSPEND _CREATE-WINDOW
127 IF SESSION:DISPLAY-TYPE = "GUI":U
THEN
128 CREATE WINDOW W-ReportViewer
ASSIGN
130 TITLE = "Report Viewer"
146 ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
148 ASSIGN {&WINDOW-NAME}:MENUBAR = MENU MENU-BAR-W-Win:HANDLE.
149 /* END WINDOW DEFINITION
*/
152 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB W-ReportViewer
153 /* ************************* Included-Libraries
*********************** */
155 {src
/adm
/method
/containr.i
}
157 /* _UIB-CODE-BLOCK-END
*/
163 /* *********** Runtime Attributes and AppBuilder Settings
*********** */
165 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
166 /* SETTINGS
FOR WINDOW W-ReportViewer
167 VISIBLE,,RUN-PERSISTENT
*/
168 /* SETTINGS
FOR FRAME F-Main
171 FRAME F-Main
:SCROLLABLE = FALSE.
174 ed-report
:AUTO-RESIZE IN FRAME F-Main
= TRUE
175 ed-report
:RETURN-INSERTED IN FRAME F-Main
= TRUE
176 ed-report
:READ-ONLY IN FRAME F-Main
= TRUE.
178 IF SESSION:DISPLAY-TYPE = "GUI":U
AND VALID-HANDLE(W-ReportViewer
)
179 THEN W-ReportViewer
:HIDDEN = yes.
181 /* _RUN-TIME-ATTRIBUTES-END
*/
188 /* ************************ Control Triggers
************************ */
190 &Scoped-define SELF-NAME W-ReportViewer
191 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-ReportViewer W-ReportViewer
192 ON END-ERROR
OF W-ReportViewer
/* Report Viewer
*/
193 OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
194 /* This case occurs when the user presses the
"Esc" key.
195 In a persistently run window
, just ignore this. If we did not
, the
196 application would exit.
*/
197 APPLY 'WINDOW-CLOSE'
:U
TO {&WINDOW-NAME}.
198 IF THIS-PROCEDURE:PERSISTENT THEN RETURN NO-APPLY.
201 /* _UIB-CODE-BLOCK-END
*/
205 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-ReportViewer W-ReportViewer
206 ON ENTRY OF W-ReportViewer
/* Report Viewer
*/
208 APPLY '
ENTRY'
:U
TO ed-report
IN FRAME {&FRAME-NAME}.
212 /* _UIB-CODE-BLOCK-END
*/
216 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-ReportViewer W-ReportViewer
217 ON WINDOW-CLOSE
OF W-ReportViewer
/* Report Viewer
*/
219 /* This ADM code must be left here in order for the SmartWindow
220 and its descendents to terminate properly on exit.
*/
222 OS-DELETE VALUE( os-ctrl-name
).
223 OS-DELETE VALUE( os-text-name
).
225 APPLY "CLOSE":U
TO THIS-PROCEDURE.
229 /* _UIB-CODE-BLOCK-END
*/
233 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-ReportViewer W-ReportViewer
234 ON WINDOW-MAXIMIZED OF W-ReportViewer
/* Report Viewer
*/
239 /* _UIB-CODE-BLOCK-END
*/
243 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-ReportViewer W-ReportViewer
244 ON WINDOW-RESIZED
OF W-ReportViewer
/* Report Viewer
*/
249 /* _UIB-CODE-BLOCK-END
*/
253 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL W-ReportViewer W-ReportViewer
254 ON WINDOW-RESTORED
OF W-ReportViewer
/* Report Viewer
*/
259 /* _UIB-CODE-BLOCK-END
*/
263 &Scoped-define SELF-NAME m_Copy
264 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Copy W-ReportViewer
265 ON CHOOSE OF MENU-ITEM m_Copy
/* Copy
*/
267 OUTPUT TO "CLIPBOARD":U
KEEP-MESSAGES.
268 PUT UNFORMATTED ed-report
:SELECTION-TEXT IN FRAME {&FRAME-NAME}.
272 /* _UIB-CODE-BLOCK-END
*/
276 &Scoped-define SELF-NAME m_Display_Font
277 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Display_Font W-ReportViewer
278 ON CHOOSE OF MENU-ITEM m_Display_Font
/* Display Font
*/
280 RUN set-display-font.
283 /* _UIB-CODE-BLOCK-END
*/
287 &Scoped-define SELF-NAME m_Exit
288 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Exit W-ReportViewer
289 ON CHOOSE OF MENU-ITEM m_Exit
/* Exit
*/
291 APPLY 'WINDOW-CLOSE'
:U
TO {&WINDOW-NAME}.
294 /* _UIB-CODE-BLOCK-END
*/
298 &Scoped-define SELF-NAME m_Find
299 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Find W-ReportViewer
300 ON CHOOSE OF MENU-ITEM m_Find
/* Find
*/
305 /* _UIB-CODE-BLOCK-END
*/
309 &Scoped-define SELF-NAME m_Print
310 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Print W-ReportViewer
311 ON CHOOSE OF MENU-ITEM m_Print
/* Print
*/
316 /* _UIB-CODE-BLOCK-END
*/
320 &Scoped-define SELF-NAME m_Printout_Font
321 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Printout_Font W-ReportViewer
322 ON CHOOSE OF MENU-ITEM m_Printout_Font
/* Printout Font
*/
324 RUN set-printout-font.
327 /* _UIB-CODE-BLOCK-END
*/
331 &Scoped-define SELF-NAME m_Save
332 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Save W-ReportViewer
333 ON CHOOSE OF MENU-ITEM m_Save
/* Save
*/
338 /* _UIB-CODE-BLOCK-END
*/
342 &Scoped-define SELF-NAME m_Save_Settings
343 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Save_Settings W-ReportViewer
344 ON CHOOSE OF MENU-ITEM m_Save_Settings
/* Save Settings
*/
349 /* _UIB-CODE-BLOCK-END
*/
353 &Scoped-define SELF-NAME m_Select_All
354 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL m_Select_All W-ReportViewer
355 ON CHOOSE OF MENU-ITEM m_Select_All
/* Select All
*/
357 IF ed-report
:SET-SELECTION( 1, ed-report
:LENGTH ) IN FRAME {&FRAME-NAME} THEN .
360 /* _UIB-CODE-BLOCK-END
*/
366 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK W-ReportViewer
369 /* *************************** Main Block
*************************** */
371 /* Include custom Main Block code for SmartWindows.
*/
372 {src
/adm
/template
/windowmn.i
}
374 /* _UIB-CODE-BLOCK-END
*/
378 /* ********************** Internal Procedures
*********************** */
380 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects W-ReportViewer _ADM-CREATE-OBJECTS
381 PROCEDURE adm-create-objects
:
382 /*------------------------------------------------------------------------------
383 Purpose
: Create handles for all SmartObjects used in this procedure.
384 After SmartObjects are initialized
, then SmartLinks are added.
386 ------------------------------------------------------------------------------*/
390 /* _UIB-CODE-BLOCK-END
*/
393 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available W-ReportViewer _ADM-ROW-AVAILABLE
394 PROCEDURE adm-row-available
:
395 /*------------------------------------------------------------------------------
396 Purpose
: Dispatched to this procedure when the Record-
397 Source has a new row available. This procedure
398 tries to get the new row
(or foriegn keys
) from
399 the Record-Source and process it.
401 ------------------------------------------------------------------------------*/
403 /* Define variables needed by this internal procedure.
*/
404 {src
/adm
/template
/row-head.i
}
406 /* Process the newly available records
(i.e. display fields
,
407 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
408 {src
/adm
/template
/row-end.i
}
412 /* _UIB-CODE-BLOCK-END
*/
415 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI W-ReportViewer _DEFAULT-DISABLE
416 PROCEDURE disable_UI
:
417 /*------------------------------------------------------------------------------
418 Purpose
: DISABLE the User Interface
420 Notes
: Here we clean-up the user-interface by deleting
421 dynamic widgets we have created and
/or hide
422 frames. This procedure is usually called when
423 we are ready to
"clean-up" after running.
424 ------------------------------------------------------------------------------*/
425 /* Delete the
WINDOW we created
*/
426 IF SESSION:DISPLAY-TYPE = "GUI":U
AND VALID-HANDLE(W-ReportViewer
)
427 THEN DELETE WIDGET W-ReportViewer.
428 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
431 /* _UIB-CODE-BLOCK-END
*/
434 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI W-ReportViewer _DEFAULT-ENABLE
435 PROCEDURE enable_UI
:
436 /*------------------------------------------------------------------------------
437 Purpose
: ENABLE the User Interface
439 Notes
: Here we display
/view
/enable the widgets in the
440 user-interface. In addition
, OPEN all queries
441 associated with each
FRAME and
BROWSE.
442 These statements here are based on the
"Other
443 Settings" section of the widget Property Sheets.
444 ------------------------------------------------------------------------------*/
446 WITH FRAME F-Main
IN WINDOW W-ReportViewer.
448 WITH FRAME F-Main
IN WINDOW W-ReportViewer.
449 {&OPEN-BROWSERS-IN-QUERY-F-Main}
453 /* _UIB-CODE-BLOCK-END
*/
456 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE find-dialog W-ReportViewer
457 PROCEDURE find-dialog
:
458 /*------------------------------------------------------------------------------
460 ------------------------------------------------------------------------------*/
461 DEF VAR search-flags
AS INT NO-UNDO INITIAL 33.
463 RUN win
/d-find.w
( INPUT-OUTPUT search-text
, INPUT-OUTPUT search-flags
).
465 IF search-flags
< 1 THEN
466 search-flags
= ABS( search-flags
).
467 ELSE IF NOT( ed-report
:SEARCH( search-text
, search-flags
) IN FRAME {&FRAME-NAME} ) THEN
468 MESSAGE "'" + search-text
+ "' not found." VIEW-AS ALERT-BOX INFORMATION
469 TITLE "Search text not found" .
473 /* _UIB-CODE-BLOCK-END
*/
476 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-current-printer W-ReportViewer
477 PROCEDURE get-current-printer
:
478 /*------------------------------------------------------------------------------
479 Purpose
: Set the value of CURRENT-PRINTER-??? to reflect the current windows
481 ------------------------------------------------------------------------------*/
482 DEF VAR CURRENT-PRINTER-NAME
AS CHAR NO-UNDO.
484 /* Set the value of the port
( more robust than printer name for batches
) */
486 DEF BUFFER CurrPrinter
FOR RP.
487 DEF VAR user-name
AS CHAR NO-UNDO.
488 {inc
/username.i
"user-name"}
490 FIND FIRST CurrPrinter
WHERE
491 CurrPrinter.UserName
= user-name
AND
492 CurrPrinter.ReportID
= "Current Printer" NO-LOCK NO-ERROR.
494 IF NOT AVAILABLE CurrPrinter
THEN
496 DEF VAR success
AS LOGI
NO-UNDO.
497 RUN aderb
/_prdef.p
( OUTPUT CURRENT-PRINTER-NAME
, OUTPUT CURRENT-PRINTER-PORT
, OUTPUT success
).
501 CurrPrinter.UserName
= user-name
502 CurrPrinter.ReportID
= "Current Printer"
503 CurrPrinter.Char1
= CURRENT-PRINTER-NAME
504 CurrPrinter.Char2
= CURRENT-PRINTER-PORT.
507 CURRENT-PRINTER-NAME
= CurrPrinter.Char1.
508 CURRENT-PRINTER-PORT
= CurrPrinter.Char2.
514 /* _UIB-CODE-BLOCK-END
*/
517 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE load-editor W-ReportViewer
518 PROCEDURE load-editor
:
519 /*------------------------------------------------------------------------------
520 Purpose
: Load the editor widget from a file
521 ------------------------------------------------------------------------------*/
522 DEF INPUT PARAM text-file-name
AS CHAR NO-UNDO.
523 DEF INPUT PARAM ctrl-file-name
AS CHAR NO-UNDO.
524 DEF VAR success
AS LOGICAL NO-UNDO.
526 IF SESSION:SET-WAIT-STATE("GENERAL") THEN .
528 os-text-name
= text-file-name
529 os-ctrl-name
= ctrl-file-name
530 success
= ed-report
:READ-FILE( text-file-name
) IN FRAME {&FRAME-NAME}
533 IF SESSION:SET-WAIT-STATE("") THEN .
534 APPLY '
ENTRY'
:U
TO {&WINDOW-NAME}.
538 /* _UIB-CODE-BLOCK-END
*/
541 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-exit W-ReportViewer
542 PROCEDURE local-exit
:
543 /* -----------------------------------------------------------
544 Purpose
: Starts an
"exit" by APPLYing
CLOSE event
, which starts
"destroy".
545 Notes
: If activated
, should
APPLY CLOSE, *not
* dispatch adm-exit.
546 -------------------------------------------------------------*/
548 OS-DELETE VALUE( os-ctrl-name
).
549 OS-DELETE VALUE( os-text-name
).
551 APPLY "CLOSE":U
TO THIS-PROCEDURE.
557 /* _UIB-CODE-BLOCK-END
*/
560 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-initialize W-ReportViewer
561 PROCEDURE local-initialize
:
562 /*------------------------------------------------------------------------------
563 Purpose
: Override standard ADM method
565 ------------------------------------------------------------------------------*/
567 /* Code placed here will execute PRIOR to standard behavior.
*/
568 {inc
/username.i
"user-name"}
569 FIND RP
WHERE RP.UserName
= user-name
570 AND RP.ReportID
= "Report Viewer" NO-LOCK NO-ERROR.
571 IF AVAILABLE(RP
) THEN DO:
572 window-w
= (IF RP.Int1
> 200 THEN RP.Int1
ELSE ((SESSION:WIDTH-PIXELS * 4) / 5)).
573 window-h
= (IF RP.Int2
> 200 THEN RP.Int2
ELSE ((SESSION:HEIGHT-PIXELS * 4) / 5)).
576 {&WINDOW-NAME}:VIRTUAL-WIDTH-PIXELS = window-w + 50
577 {&WINDOW-NAME}:VIRTUAL-HEIGHT-PIXELS = window-h + 50
578 {&WINDOW-NAME}:WIDTH-PIXELS = window-w
579 {&WINDOW-NAME}:HEIGHT-PIXELS = window-h
580 save-directory
= RP.Char1
581 search-text
= RP.Char2
582 search-flags
= RP.Int3
587 /* Dispatch standard ADM method.
*/
588 RUN dispatch
IN THIS-PROCEDURE ( INPUT 'initialize'
:U
) .
590 /* Code placed here will execute AFTER standard behavior.
*/
594 /* _UIB-CODE-BLOCK-END
*/
597 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-report W-ReportViewer
598 PROCEDURE print-report
:
599 /*------------------------------------------------------------------------------
600 Purpose
: Print the report and close the window
601 ------------------------------------------------------------------------------*/
602 IF printout-w32
THEN DO:
603 DEF VAR success
AS INT INITIAL 0 NO-UNDO.
604 DEF VAR lsuccess
AS LOGICAL INITIAL No
NO-UNDO.
605 DEF VAR pr-flags
AS INT NO-UNDO.
607 pr-flags
= (IF printout-dlg
THEN 1 ELSE 0)
608 + (IF printout-lscp
THEN 2 ELSE 0).
610 RUN adecomm
/_osprint.p
( {&WINDOW-NAME}:HANDLE, os-text-name, printout-font,
611 pr-flags
, 0, 0, OUTPUT lsuccess
).
615 DEF VAR dir-name
AS CHAR NO-UNDO.
616 DEF VAR control-name
AS CHAR NO-UNDO.
617 DEF VAR print-name
AS CHAR NO-UNDO.
618 DEF VAR cmd
AS CHAR NO-UNDO.
620 RUN get-current-printer.
622 dir-name
= SUBSTRING( os-text-name
, 1, R-INDEX(os-text-name
, "\") ).
623 control-name
= SUBSTRING( os-ctrl-name
, R-INDEX(os-ctrl-name
, "\") + 1 ).
624 print-name
= SUBSTRING( os-text-name
, R-INDEX(os-text-name
, "\") + 1 ).
625 cmd
= "PP " + CURRENT-PRINTER-PORT
+ " " + dir-name
+ " " + control-name
+ " " + print-name.
626 OS-COMMAND SILENT VALUE( cmd
).
629 APPLY 'WINDOW-CLOSE'
:U
TO {&WINDOW-NAME}.
633 /* _UIB-CODE-BLOCK-END
*/
636 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE resize-editor W-ReportViewer
637 PROCEDURE resize-editor
:
638 /*------------------------------------------------------------------------------
639 Purpose
: Resize the editor widget to match the window size
640 ------------------------------------------------------------------------------*/
641 DO WITH FRAME {&FRAME-NAME}:
644 * The error-free order of assignment depends on whether the window
645 * size is increasing or diminishing in each direction.
647 IF {&WINDOW-NAME}:WIDTH-PIXELS > ed-report:WIDTH-PIXELS THEN ASSIGN
648 FRAME {&FRAME-NAME}:WIDTH-PIXELS = {&WINDOW-NAME}:WIDTH-PIXELS + 8
649 ed-report
:WIDTH-PIXELS = {&WINDOW-NAME}:WIDTH-PIXELS.
651 ed-report
:WIDTH-PIXELS = {&WINDOW-NAME}:WIDTH-PIXELS
652 FRAME {&FRAME-NAME}:WIDTH-PIXELS = {&WINDOW-NAME}:WIDTH-PIXELS + 8.
654 IF {&WINDOW-NAME}:HEIGHT-PIXELS > ed-report:HEIGHT-PIXELS THEN ASSIGN
655 FRAME {&FRAME-NAME}:HEIGHT-PIXELS = {&WINDOW-NAME}:HEIGHT-PIXELS + 8
656 ed-report
:HEIGHT-PIXELS = {&WINDOW-NAME}:HEIGHT-PIXELS.
658 ed-report
:HEIGHT-PIXELS = {&WINDOW-NAME}:HEIGHT-PIXELS
659 FRAME {&FRAME-NAME}:HEIGHT-PIXELS = {&WINDOW-NAME}:HEIGHT-PIXELS + 8.
663 /* _UIB-CODE-BLOCK-END
*/
666 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE save-report W-ReportViewer
667 PROCEDURE save-report
:
668 /*------------------------------------------------------------------------------
669 Purpose
: Save the report to a file and close the window
670 ------------------------------------------------------------------------------*/
671 DEF VAR cmd-line
AS CHAR NO-UNDO.
672 DEF VAR new-file-name
AS CHAR NO-UNDO.
673 DEF VAR dialog-ok
AS LOGI
INITIAL Yes
NO-UNDO.
676 SYSTEM-DIALOG GET-FILE new-file-name
FILTERS "Text files" "*.TXT"
677 INITIAL-FILTER 1 ASK-OVERWRITE CREATE-TEST-FILE
678 DEFAULT-EXTENSION ".TXT" INITIAL-DIR save-directory
679 SAVE-AS RETURN-TO-START-DIR UPDATE dialog-ok.
681 IF dialog-ok
THEN DO:
682 OS-COPY VALUE( os-text-name
) VALUE( new-file-name
).
683 MESSAGE '
"' + new-file-name + '" saved.'
VIEW-AS ALERT-BOX INFORMATION
684 TITLE "Report Viewer Action".
686 save-directory
= SUBSTRING( new-file-name
, 1, R-INDEX( new-file-name
, "\")).
692 /* _UIB-CODE-BLOCK-END
*/
695 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE save-settings W-ReportViewer
696 PROCEDURE save-settings
:
697 /*------------------------------------------------------------------------------
698 Purpose
: Save current settings of the window
(x
, y
, save directory
).
699 ------------------------------------------------------------------------------*/
700 DEF VAR user-name
AS CHAR NO-UNDO.
701 DEF VAR DisplayFontString
AS CHAR FORMAT "x(128)" NO-UNDO.
702 DEF VAR PrinterFontString
AS CHAR FORMAT "x(128)" NO-UNDO.
704 PUT-KEY-VALUE FONT display-font
NO-ERROR.
705 PUT-KEY-VALUE FONT printout-font
NO-ERROR.
706 GET-KEY-VALUE SECTION "Fonts" KEY "Font28" VALUE DisplayFontString.
707 GET-KEY-VALUE SECTION "Fonts" KEY "Font29" VALUE PrinterFontString.
709 {inc
/username.i
"user-name"}
711 FIND RP
WHERE RP.UserName
= user-name
712 AND RP.ReportID
= "Report Viewer" EXCLUSIVE-LOCK NO-ERROR.
713 IF NOT AVAILABLE(RP
) THEN CREATE RP.
714 ASSIGN window-w
= {&WINDOW-NAME}:WIDTH-PIXELS
715 window-h
= {&WINDOW-NAME}:HEIGHT-PIXELS.
717 RP.UserName
= user-name
718 RP.ReportID
= "Report Viewer"
721 RP.Char1
= save-directory
722 RP.Char2
= search-text
723 RP.Int3
= search-flags
724 RP.Char3
= DisplayFontString
725 RP.Char4
= PrinterFontString
731 /* _UIB-CODE-BLOCK-END
*/
734 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records W-ReportViewer _ADM-SEND-RECORDS
735 PROCEDURE send-records
:
736 /*------------------------------------------------------------------------------
737 Purpose
: Send record
ROWID's for all tables used by
739 Parameters
: see template
/snd-head.i
740 ------------------------------------------------------------------------------*/
742 /* SEND-RECORDS does nothing because there are no External
743 Tables specified for this SmartWindow
, and there are no
744 tables specified in any contained Browse
, Query
, or Frame.
*/
748 /* _UIB-CODE-BLOCK-END
*/
751 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-display-font W-ReportViewer
752 PROCEDURE set-display-font
:
753 /*------------------------------------------------------------------------------
754 Purpose
: Set the font used in the editor window
755 ------------------------------------------------------------------------------*/
756 DEF VAR dialog-ok
AS LOGI
INITIAL Yes
NO-UNDO.
758 SYSTEM-DIALOG FONT display-font
FIXED-ONLY MAX-SIZE 14 MIN-SIZE 6 UPDATE dialog-ok.
760 IF dialog-ok
THEN DO:
761 ed-report
:FONT IN FRAME {&FRAME-NAME} = display-font.
766 /* _UIB-CODE-BLOCK-END
*/
769 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-print-details W-ReportViewer
770 PROCEDURE set-print-details
:
771 /*------------------------------------------------------------------------------
773 ------------------------------------------------------------------------------*/
774 DEF INPUT PARAMETER font-num
AS INTEGER NO-UNDO.
775 DEF INPUT PARAMETER landscape
AS LOGICAL NO-UNDO.
776 DEF INPUT PARAMETER show-dialog
AS LOGICAL NO-UNDO.
779 printout-font
= (IF font-num
<> ?
THEN font-num
ELSE printout-font
)
780 printout-lscp
= landscape
781 printout-dlg
= show-dialog
787 /* _UIB-CODE-BLOCK-END
*/
790 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-printout-font W-ReportViewer
791 PROCEDURE set-printout-font
:
792 /*------------------------------------------------------------------------------
793 Purpose
: Set the font used in the editor window
794 ------------------------------------------------------------------------------*/
796 SYSTEM-DIALOG FONT printout-font
FIXED-ONLY MAX-SIZE 14 MIN-SIZE 5.
800 /* _UIB-CODE-BLOCK-END
*/
803 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-title W-ReportViewer
804 PROCEDURE set-title
:
805 /*------------------------------------------------------------------------------
806 Purpose
: Set the subsidiary title of the viewer
807 ------------------------------------------------------------------------------*/
808 DEF INPUT PARAMETER title-text
AS CHAR NO-UNDO.
810 {&WINDOW-NAME}:TITLE = "Report Viewer - " + title-text + " - " + STRING( TIME, "HH:MM:SS").
811 APPLY '
ENTRY'
:U
TO ed-report
IN FRAME {&FRAME-NAME}.
814 /* _UIB-CODE-BLOCK-END
*/
817 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed W-ReportViewer
818 PROCEDURE state-changed
:
819 /* -----------------------------------------------------------
823 -------------------------------------------------------------*/
824 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
825 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
828 /* _UIB-CODE-BLOCK-END
*/