Module SigCJReportControlDemo - Text.vw

     1Use Windows.pkg
     2Use Dfclient.pkg
     3Use DFEntry.pkg
     4Use cSigCjReportControl.pkg
     5Use cSigCJContextMenu.pkg
     6Use cSigCJMenuItem.pkg
     7
     8Deferred_View Activate_SigCjReportControlDemo_Text_View for ;
     9Object SigCjReportControlDemo_Text_View is a dbView
    10    Set Border_Style to Border_Thick
    11    Set Size to 250 400
    12    Set Location to 2 2
    13    Set Maximize_Icon to True
    14    Set Label to "Codejock Demo - Report Control - Text File"
    15    Set Icon to "SIG.ico"
    16        
    17    Object oSigCJReportControl1 is a cSigCJReportControl
    18        Set Size to 174 382
    19        Set Location to 33 7
    20        Set peAnchors to anAll
    21        Set peDb_Type to eRC_db_Text
    22        Set pbActive_Track to True
    23        Set pbPX_Save_Layout to True
    24        Set psPX_Tag to (Label(Parent(Self)))
    25
    26        Object oSigCJContextMenu is a cSigCJContextMenu
    27            Send Add_MenuItem "Rebuild"                "Rebuild_Report"   False  "" 
    28            Send Add_MenuItem "Refresh"                "Refresh_Report"   False  "" 
    29            If (phoFieldChooser(Self)) Begin
    30                Send Add_MenuItem "Field Chooser"      "FieldChooser"     True   ""
    31                Send Add_MenuItem "Default Layout"     "DefaultLayout"    False   ""
    32            End
    33            Send Add_MenuItem "Select All"             "SelectAll"        True   "" 
    34            Send Add_MenuItem "Deselect All"           "DeselectAll"      False  "" 
    35            Send Add_MenuItem "Invert Selection"       "Invert_Selection" False  "" 
    36            Send Add_MenuItem "Preview Report"         "PreviewReport"    True   "" 
    37            Send Add_MenuItem "Print Report"           "PrintReport"      False  "" 
    38            Send Add_MenuItem "Export To CSV"          "CSV_Export"       False  ""
    39            Send Add_MenuItem "Process Selected Rows"  "Process_Rows"     True   ""
    40        End_Object
    41
    42        Procedure OnDefine_Columns
    43            Send Add_Report_Column "Date"         60 eRC_Date    eRC_Standard "" ""
    44            Send Add_Report_Column "Time"         60 eRC_String  eRC_Standard "" ""
    45            Send Add_Report_Column "User"        120 eRC_String  eRC_Standard "" ""
    46            Send Add_Report_Column "Workstation" 200 eRC_String  eRC_Standard "" ""
    47            Send Add_Report_Column "Ip Addess"   160 eRC_String  eRC_Standard "" ""
    48            Send Add_Report_Column "Error No."    60 eRC_String  eRC_Standard "" ""
    49            Send Add_Report_Column "Error Line"   80 eRC_Integer eRC_Standard "" ""
    50            Send Add_Report_Column "Error Text"  300 eRC_Text    eRC_Standard "" ""
    51        End_Procedure
    52
    53        //---------------------------------------------------------------------
    54
    55        Procedure OnOpen_DataSource
    56            //Hook - open data source here
    57
    58            Integer iCh_No
    59            String sLine sPath
    60
    61            Get psHome of (phoWorkspace(ghoApplication)) to sPath
    62            
    63            Get Seq_New_Channel to iCh_No
    64            Set piCh_No to iCh_No
    65
    66            Direct_Input channel iCh_No (sPath - "\Data\Error.log")
    67
    68            Readln channel iCh_No sLine        //Skip header rows
    69            Readln channel iCh_No sLine
    70            Set pbEOF to (SeqEof)
    71        End_Procedure
    72
    73        Procedure OnPrepare_RowData
    74            //Hook - Set up row data ( Send Add_Item_Data for each column )
    75
    76            Integer iCh_No iLoop iColumn_Count
    77            String  sLine
    78            
    79            Get piCh_No     to iCh_No
    80            Get piColumn_Count to iColumn_Count
    81
    82            Readln channel iCh_No sLine
    83            If (SeqEof) Begin
    84                Set pbEOF to True
    85            End
    86            Else Begin
    87                Send Add_Item_Data (Mid(sLine,                    10,   1)) //Date       
    88                Send Add_Item_Data (Mid(sLine,                     8,  12)) //Time       
    89                Send Add_Item_Data (Mid(sLine,                    11,  21)) //User       
    90                Send Add_Item_Data (Mid(sLine,                    19,  33)) //Workstation
    91                Send Add_Item_Data (Mid(sLine,                    15,  53)) //Ip Addess  
    92                Send Add_Item_Data (Mid(sLine,                     5,  75)) //Error No.  
    93                Send Add_Item_Data (Mid(sLine,                     7,  96)) //Error Line 
    94                Send Add_Item_Data (Mid(sLine, (Length(sLine) - 105), 106)) //Error Text 
    95            End            
    96        End_Procedure
    97
    98        Procedure OnClose_DataSource
    99            //Hook - safe to close data source here
   100
   101            Integer iCh_No 
   102            Get piCh_No to iCh_No
   103
   104            Close_Input channel iCh_No
   105            Send Seq_Release_Channel iCh_No
   106        End_Procedure
   107
   108        //---------------------------------------------------------------------
   109
   110        Procedure OnComRowRClick Variant llRow Variant llItem
   111            Send Popup of oSigCJContextMenu
   112        End_Procedure
   113
   114        Procedure OnProcess_Rows String sID
   115            //Showln "OnProcess_Rows : " sID
   116        End_Procedure
   117
   118        Procedure OnDouble_Click String sID
   119            //Showln "Click Click : " sID
   120        End_Procedure
   121
   122        Procedure OnActive_Track String sID
   123            Set value of oActive_Track_Row to sID
   124        End_Procedure
   125        
   126        Procedure OnAfter_Load_Data
   127            //Showln "Rows: " (piRow_Count(Self)) " Time taken: " (ptsTimeSpan_Load(Self)) " SQL Exe " (ptsTimeSpan_SQL(Self))
   128        End_Procedure
   129
   130    End_Object
   131
   132    Object oGroup1 is a Group
   133        Set Size to 29 387
   134        Set Location to 1 4
   135        Set peAnchors to anTopLeftRight
   136
   137        Object oActive_Track_cb is a CheckBox
   138            Set Location to 12 10
   139            Set Size to 10 50
   140            Set Label to "Active Track"
   141
   142            Procedure OnChange
   143                Boolean bChecked
   144
   145                Get Checked_State to bChecked
   146                Set pbActive_Track of oSigCJReportControl1 to bChecked
   147            End_Procedure
   148
   149        End_Object
   150        Object oSort_On_Group_cb is a CheckBox
   151            Set Size to 10 50
   152            Set Location to 12 72
   153            Set Label to "Sort On Group"
   154
   155            Procedure OnChange
   156                Boolean bChecked
   157
   158                Get Checked_State to bChecked
   159                Set pbGroup_Sorted_Columns of oSigCJReportControl1 to bChecked
   160            End_Procedure
   161
   162        End_Object
   163
   164        Object oFilter_Search_Form is a Form
   165            Set Size to 13 102
   166            Set Location to 10 278
   167            Set peAnchors to anBottomRight
   168            Set Label_Col_Offset to 2
   169            Set Label_Justification_Mode to JMode_Right
   170            Set Label to "Filter Search"
   171            
   172            Set Form_Button        0 to Form_Button_Prompt
   173            Set Form_Button_Bitmap 0 to "ieref.bmp"
   174            Set Prompt_Button_Mode to PB_PromptOn
   175            On_Key kClear Send Prompt
   176            On_Key kEnter Send Prompt 
   177    
   178            Procedure OnChange
   179                String sValue
   180            
   181                Get Value to sValue
   182                If (Trim(sValue) = "") Begin
   183                    Send Filter_Rows of oSigCJReportControl1 sValue
   184                End    
   185            End_Procedure
   186            
   187            Procedure Prompt 
   188                String sValue
   189            
   190                Get Value to sValue
   191                Send Filter_Rows of oSigCJReportControl1 sValue
   192            End_Procedure
   193        End_Object
   194
   195    End_Object
   196
   197    Object oActive_Track_Row is a Form
   198        Set Location to 214 31
   199        Set Size to 13 52
   200        Set Label to "Row"
   201        Set Label_Justification_Mode to JMode_Right
   202        Set Label_Col_Offset to 2
   203        Set peAnchors to anBottomLeft
   204    End_Object
   205
   206    Object oButton1 is a Button
   207        Set Location to 217 343
   208        Set Label to "ReLoad"
   209        Set peAnchors to anBottomRight
   210    
   211        // fires when the button is clicked
   212        Procedure OnClick
   213            Send Reset_Data_Properties of oSigCJReportControl1
   214            Send Rebuild_Report        of oSigCJReportControl1
   215        End_Procedure
   216    
   217    End_Object
   218
   219Cd_End_Object
   220