Module CrystalTest.src

     1//*************************************************************************
     2//*                                                                       *
     3//*  Confidential Trade Secret.                                           *
     4//*  Copyright (c) 2011-2012 Mertech Data Systems Inc, Miami Florida      *
     5//*  All rights reserved.                                                 *
     6//*  DataFlex is a registered trademark of Data Access Corporation.       *
     7//*                                                                       *
     8//*************************************************************************
     9//  TestProject for Windows application
    10
    11Use DFAllEnt.pkg
    12Use cCJStandardCommandBarSystem.pkg
    13
    14Object oHtmlHelp is a cHtmlHelp
    15End_Object
    16
    17Object oApplication is a cApplication
    18    Set pbPreserveEnvironment to False
    19    Set peHelpType to htHtmlHelp
    20End_Object
    21
    22//Object oToolTipController is a cToolTipController
    23//    Move Self to ghoToolTipController
    24//End_Object
    25
    26Use oEditContextMenu.pkg
    27Use oDEOEditContextMenu.pkg
    28
    29Object oMain is a Panel
    30
    31    Property Handle phoViewMenu 0
    32    Property Handle phoReportMenu 0
    33
    34    Set Label to "Flex2Crystal Test Program"
    35    Set Location to 4 3
    36    Set Size to 300 450
    37    Set View_Mode to ViewMode_Zoom
    38
    39    Object oCommandBarSystem is a cCJCommandBarSystem
    40        Set pbTimerUpdate to True
    41
    42        Procedure OnCreateCommandBars
    43            Handle hoOptions
    44            Get OptionsObject to hoOptions
    45            Forward Send OnCreateCommandBars
    46        End_Procedure
    47
    48        Object oMenuBar is a cCJMenuBar
    49
    50            Object oFileMenu is a cCJMenuItem
    51                Set peControlType to xtpControlPopup          
    52                Set psCaption to "&File"
    53                Set psDescription to "Find, Save, Delete, Clear information or quit this application."
    54                Set psCategory to "Menus"
    55
    56                Object oClearMenuItem is a cCJClearMenuItem
    57                    Set pbAddToDesignerMenu to True
    58                End_Object
    59
    60                Object oClearAllMenu is a cCJClearAllMenuItem
    61                    Set pbAddToDesignerMenu to True
    62                End_Object
    63
    64                Object oPromptMenuItem is a cCJPromptMenuItem
    65                    Set pbAddToDesignerMenu to True
    66                    Set pbControlBeginGroup to True
    67                End_Object
    68
    69                Object oFindMenuItem is a cCJFindMenuItem
    70                    Set pbAddToDesignerMenu to True
    71                    Set pbControlBeginGroup to True
    72                End_Object
    73
    74                Object oFindNextMenu is a cCJFindNextMenuItem
    75                    Set pbAddToDesignerMenu to True
    76                End_Object
    77
    78                Object oFindPreviousMenu is a cCJFindPreviousMenuItem
    79                    Set pbAddToDesignerMenu to True
    80                End_Object
    81
    82                Object oFindFirstMenu is a cCJFindFirstMenuItem
    83                    Set pbAddToDesignerMenu to True
    84                End_Object
    85
    86                Object oFindLastMenu is a cCJFindLastMenuItem
    87                    Set pbAddToDesignerMenu to True
    88                End_Object
    89
    90                Object oSaveMenuItem is a cCJSaveMenuItem
    91                    Set pbAddToDesignerMenu to True
    92                    Set pbControlBeginGroup to True
    93                End_Object
    94
    95                Object oDeleteMenuItem is a cCJDeleteMenuItem
    96                    Set pbAddToDesignerMenu to True
    97                End_Object
    98
    99                Object oExitMenu is a cCJExitMenuItem
   100                    Set pbControlBeginGroup to True
   101                End_Object
   102
   103            End_Object
   104
   105            Object oViewMenu is a cCJMenuItem
   106                Set peControlType to xtpControlPopup          
   107                Set psCaption to "&View"
   108                Set psToolTip to "View"
   109                Set psDescription to "Available Views"
   110
   111                // for testing we define the view and report menus for auto activate
   112                Delegate Set phoViewMenu to Self
   113            End_Object
   114
   115            Object oReportMenu is a cCJMenuItem
   116                Set peControlType to xtpControlPopup
   117                Set psCaption to "&Report"
   118                Set psToolTip to "Report"
   119                Set psDescription to "Available Reports"
   120
   121                Object oCrystalReportsPreviewerMenuItem is a cCJMenuItem
   122                    Set psCaption to "Crystal Reports Previewer"
   123                    Set psTooltip to "Crystal Reports Previewer"
   124                
   125                    Procedure OnExecute Variant vCommandBarControl
   126                        Handle hoClient
   127                        Get Client_Id to hoClient
   128                        Send Activate_oReportPreviewCR of hoClient
   129                    End_Procedure
   130                End_Object
   131
   132                // for testing we define the view and report menus for auto activate
   133                Delegate Set phoReportMenu to Self
   134            End_Object
   135
   136            Object oNavigateMenu is a cCJMenuItem
   137                Set peControlType to xtpControlPopup      
   138                Set psCaption to "&Navigate"    
   139                Set psTooltip to "Navigate"    
   140                Set psDescription to "Move to different areas of the application"
   141
   142                Object oNextAreaMenu is a cCJNextAreaMenu
   143                End_Object
   144
   145                Object oPriorAreaMenu is a cCJPriorAreaMenu
   146                End_Object
   147
   148                Object oNextViewMenu is a cCJNextViewMenu
   149                End_Object
   150
   151                Object oPriorViewMenu is a cCJPriorViewMenu
   152                End_Object
   153
   154                Object oPromptMenu is a cCJPromptMenuItem
   155                    Set pbControlBeginGroup to True
   156                End_Object
   157
   158                Object oZoomMenu is a cCJZoomMenuItem
   159                End_Object
   160
   161            End_Object
   162
   163            Object oWindowMenu is a cCJMDIWindowsMenuItem
   164                Set peControlType to xtpControlPopup      
   165                Set psCaption to "&Window"
   166                Set psToolTip to "Window"
   167                Set psDescription to "Display Current Views and set other display options."    
   168
   169                // These are the static windows items. More will be created in onPopupInit
   170                Object oDisplayOptionsMenu is a cCJMenuItem
   171                    Set peControlType to xtpControlPopup              
   172                    Set psCaption to "&Display Options"
   173                    Set psToolTip to "Display Options"
   174                    Set psDescription to "Set display options"
   175
   176                    Object oStatusbarMenu is a cCJStatusbarMenuItem
   177                    End_Object
   178
   179                    Object oAutoArrangeIconsMenu is a cCJAutoArrangeIconsMenuItem
   180                    End_Object
   181
   182                    Object oRestoreMenusMenu is a cCJRestoreMenusMenuItem
   183                        Set pbControlBeginGroup to True
   184                    End_Object
   185
   186                End_Object
   187
   188                Object oCascadeMenu is a cCJCascadeMenuItem
   189                    Set pbControlBeginGroup to True
   190                End_Object
   191
   192                Object oHorizTile is a cCJTileHorizontally
   193                End_Object
   194
   195                Object oVertTile is a cCJTileVertically
   196                End_Object
   197
   198                Object oMinimizeMenuItem is a cCJMinimizeWindowsMenuItem
   199                    Set pbControlBeginGroup to True
   200                End_Object
   201
   202                Object oRestoreMenuItem is a cCJRestoreWindowsMenuItem
   203                End_Object
   204
   205                Object oArrangeIconsMenuItem is a cCJAutoArrangeIconsMenuItem
   206                    Set pbControlBeginGroup to True
   207                End_Object
   208
   209            End_Object
   210
   211            Object oHelpMenu is a cCJMenuItem
   212                Set peControlType to xtpControlPopup    
   213                Set psCaption to "&Help"
   214                Set psDescription to "Access Information for learning and using this DataFlex application."
   215                Set psToolTip to "Help"
   216
   217                Object oHelpMenuItem is a cCJHelpMenuItem 
   218                End_Object
   219
   220                Object oAboutMenuItem is a cCJAboutMenuItem
   221                End_Object
   222
   223            End_Object
   224
   225        End_Object
   226
   227        Object oFindToolBar is a cCJToolbar
   228            Set psTitle to "Finding Toolbar"
   229
   230            Object oFindFirstTool is a cCJFindFirstMenuItem
   231            End_Object
   232
   233            Object oFindPreviousTool is a cCJFindPreviousMenuItem
   234            End_Object
   235
   236            Object oFindMenuTool is a cCJFindMenuItem
   237            End_Object
   238
   239            Object oFindNextTool is a cCJFindNextMenuItem
   240            End_Object
   241
   242            Object oFindLastTool is a cCJFindLastMenuItem
   243            End_Object
   244
   245            Object oPromptToolItem is a cCJPromptMenuItem
   246                Set pbControlBeginGroup to True
   247            End_Object
   248
   249        End_Object
   250
   251        Object oFileToolBar is a cCJToolbar
   252            Set psTitle to "Data Entry Toolbar"
   253
   254            Object oClearToolItem is a cCJClearMenuItem
   255                Set peControlStyle to xtpButtonIconAndCaption
   256            End_Object
   257
   258            Object oClearAllToolItem2 is a cCJClearAllMenuItem
   259                Set peControlStyle to xtpButtonIconAndCaption
   260            End_Object
   261
   262            Object oSaveToolItem is a cCJSaveMenuItem
   263                Set peControlStyle to xtpButtonIconAndCaption
   264                Set pbControlBeginGroup to True
   265            End_Object
   266
   267            Object oDeleteToolItem is a cCJDeleteMenuItem
   268                Set peControlStyle to xtpButtonIconAndCaption
   269            End_Object
   270
   271        End_Object
   272
   273        Object oEditToolBar is a cCJToolbar
   274            Set psTitle to "Edit Toolbar"
   275
   276            Object oCutToolbarItem is a cCJCutMenuItem
   277            End_Object
   278
   279            Object oCopyToolbarItem is a cCJCopyMenuItem
   280            End_Object
   281
   282            Object oPasteToolbarItem is a cCJPasteMenuItem
   283            End_Object
   284
   285            Object oDeleteEditToolbarItem is a cCJDeleteEditMenuItem
   286                Set pbControlBeginGroup to True
   287            End_Object
   288
   289        End_Object
   290
   291        Object oStatusBar is a cCJStatusBar
   292
   293            Object oStatusPane1 is a cCJStatusBarPane
   294                Set piID to sbpIDIdlePane
   295                Set pbStyleStretch to True
   296            End_Object
   297
   298            Object oStatusPane2 is a cCJStatusBarPane
   299                Set phoViewPane to Self
   300                Set pbStyleStretch to True
   301            End_Object
   302
   303        End_Object
   304
   305    End_Object
   306
   307    Object oClientArea is a ClientArea
   308
   309        Use Dd_debug.dg // This Provides access to dd debugger by pressing ctrl+d within any view. Good for debugging
   310
   311        Use StdAbout.pkg
   312        Use ReportPreviewCR.rv
   313
   314        Procedure Activate_About
   315            Send DoAbout "Test Windows Project" "0.0.0" "" "" ""
   316        End_Procedure
   317
   318    End_Object
   319
   320
   321    // All of the code below are methods and augmentations which makes this work well as a test program. This:
   322    // 1. Supports an auto-activate feature where all dialogs in the view and report menu are activated upon startup
   323    // 2. forces the panel to resize if it is not large enough to accomodate all of the views.
   324    // This code was placed directly in the testproject template and, therefore, directly in the .src file so
   325    // a developer can easily modify this to fit their own needs. It is not expected that these techniques would
   326    // get used in actual deployed projects.
   327
   328    // special test component code to activate all views and reports. For testing we assume
   329    // that you want to see everything.
   330
   331    Procedure AutoActivate
   332        Handle hoMenu
   333
   334        // this activates all views from the view menu
   335        Get phoViewMenu to hoMenu
   336        If hoMenu Begin
   337           Broadcast Send Execute of hoMenu
   338        End
   339
   340        // this activates all views from the report view menu
   341        Get phoReportMenu to hoMenu
   342        If hoMenu Begin
   343           Broadcast Send Execute of hoMenu
   344        End
   345    End_Procedure
   346
   347    // This checks all views within the client area to make sure that they fit within
   348    // the client area. If not we will adjust the main panel so everything fits. This
   349    // can only be done after the objects are all activated.
   350
   351    // special test program  augmentation which opens all views and report views and
   352    // makes sure that the size of the panel is big enough
   353
   354    Procedure End_Construct_Object
   355        Boolean bAutoActivate
   356        Get Auto_Activate_State to bAutoActivate
   357        Forward Send End_Construct_Object
   358        If bAutoActivate Begin
   359            Send AutoActivate       // activate all views and report views
   360        End
   361    End_Procedure
   362
   363End_Object
   364
   365Start_UI