// Use LogFile.pkg // Object for specifying log file properties // // by Sture Andersen // Use LogFile.nui // Class for handling a log file (No User Interface) Use Files.utl // Utilities for handling file related stuff Use Output.utl // Basic sequential output service Use Dates.nui // Date routines (No User Interface) #IFDEF IS$WINDOWS Use APS // Auto Positioning and Sizing classes for VDF Use Buttons.utl // Button texts object oLogFilePropertiesPanel is a aps.ModalPanel label "Log file settings" set locate_mode to CENTER_ON_SCREEN property integer phLogFile public 0 on_key kcancel send close_panel object oFrm1 is a aps.Form abstract AFT_ASCII60 label "Current log file is:" set label_justification_mode to JMODE_TOP set object_shadow_state to DFTRUE end_object send aps_new_field_row send aps_make_row_space 5 object oFrm2 is a aps.Form abstract AFT_ASCII15 label "Size:" set object_shadow_state to DFTRUE end_object procedure DoUpdateFile local integer lhLogFile local string lsFile get phLogFile to lhLogFile get psFileName of lhLogFile to lsFile set value of (oFrm1(self)) item 0 to lsFile if (SEQ_FileExists(lsFile)=SEQIT_FILE) begin set value of (oFrm2(self)) item 0 to (SEQ_FileSizeToString(SEQ_FileSize(lsFile))) set value of (oFrm3(self)) item 0 to (TS_ConvertToString(SEQ_FileModTime(lsFile))) end else begin set value of (oFrm2(self)) item 0 to "-" set value of (oFrm3(self)) item 0 to "-" end end_procedure procedure DoView runprogram BACKGROUND ("notepad "+psFileName(phLogFile(self))) end_procedure procedure DoReset send DeleteFile to (phLogFile(self)) send DoUpdateFile end_procedure object oFrm3 is a aps.Form abstract AFT_ASCII25 label "Time stamp:" snap SL_RIGHT_SPACE set object_shadow_state to DFTRUE end_object object oBtn1 is a aps.Multi_Button on_item "View file" send DoView end_object object oBtn1 is a aps.Multi_Button on_item "Reset file" send DoReset end_object object oBtn1 is a aps.Multi_Button on_item t.btn.close send close_panel end_object send aps_locate_multi_buttons procedure popup.i integer lhLogFile local integer rval# set phLogFile to lhLogFile send DoUpdateFile send popup end_procedure end_object // oLogFilePropertiesPanel #ELSE /oLogFilePropertiesPanel.hdr ÉÍLog file settingÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» /oLogFilePropertiesPanel.frm º º º º º Current log file is: º º ____________________________________________________ º º º º Size: _______ Time stamp: ________________________ º º º º º /oLogFilePropertiesPanel.btn º _______________ ______________ _____________ º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ /* Use App.utl // Character Mode classes Use Buttons.utl // Button texts object oLogFilePropertiesPanel is a app.ModalClient oLogFilePropertiesPanel.hdr property integer phLogFile public 0 set location to 6 16 absolute on_key ksave_record send ok on_key kcancel send cancel object oFrm is a Form oLogFilePropertiesPanel.frm set location to 1 0 relative set focus_mode to POINTER_ONLY item_list on_item "" send none on_item "" send none on_item "" send none end_item_list end_object procedure DoUpdateFile local integer lhLogFile local string lsFile get phLogFile to lhLogFile get psFileName of lhLogFile to lsFile set value of (oFrm(self)) item 0 to lsFile if (SEQ_FileExists(lsFile)=SEQIT_FILE) begin set value of (oFrm(self)) item 1 to (SEQ_FileSizeToString(SEQ_FileSize(lsFile))) set value of (oFrm(self)) item 2 to (TS_ConvertToString(SEQ_FileModTime(lsFile))) end else begin set value of (oFrm(self)) item 1 to "-" set value of (oFrm(self)) item 2 to "-" end end_procedure procedure DoView send output.display_file (psFileName(phLogFile(self))) end_procedure procedure DoReset send DeleteFile to (phLogFile(self)) send DoUpdateFile end_procedure object oBtn is a app.Button oLogFilePropertiesPanel.btn set location to 9 0 relative item_list on_item "View file" send DoView on_item "Reset file" send DoReset on_item t.btn.close send cancel end_item_list end_object procedure popup.i integer lhLogFile local integer rval# set phLogFile to lhLogFile send DoUpdateFile ui_accept self to rval# end_procedure end_object // oLogFilePropertiesPanel #ENDIF procedure Popup_LogFileProperties global integer lhLogFile send popup.i to (oLogFilePropertiesPanel(self)) lhLogFile end_procedure