Use Windows.pkg Use cCJGrid.pkg Use cCJGridColumn.pkg Object Editer_record_dg is a ModalPanel Property Boolean pbChangedData // If any of the data has changed. Property RowID prwCurrentRecord // Current record Property String[] psRecord // Data from the curren record before changes. Set Border_Style to Border_Thick Set Label to "Edit record" Set Location to 14 45 Set Size to 253 375 Set piMinSize to 78 368 Object oBox is a Container3d Set Size to 229 369 Set Location to 2 2 Set peAnchors to anAll Object oRecordGrid is a cCJGrid Set Size to 225 365 Set Location to 0 0 Set peAnchors to anAll Set pbAllowColumnRemove to False Set pbAllowColumnReorder to False Set pbAllowAppendRow to False Set pbAllowDeleteRow to False Set pbAllowInsertRow to False Set pbAutoAppend to False Set pbDrawGridForEmptySpace to False Set pbEditOnClick to True Set pbEditOnKeyNavigation to True Set piGridLineColor to 14342361 Set peVerticalGridStyle to xtpGridNoLines Object oFielddescription is a cCJGridColumn Set piWidth to 256 Set psCaption to "Fieldname and fieldtypes" Set pbFocusable to False Set piDisabledColor to clBtnFace Set piDisabledTextColor to clWindowText End_Object Object oContents is a cCJGridColumn Set piWidth to 291 Set psCaption to "Contents" Procedure OnSetDisplayMetrics Handle hoGridItemMetrics Integer iRow String ByRef sValue Integer iFieldType Forward Send OnSetDisplayMetrics hoGridItemMetrics iRow (&sValue) Get integer_value of aFilDef item (((iRow + 1) * 4) + 1) to iFieldType If ((iFieldType = DF_BINARY) or (iFieldType = DF_OVERLAP) or (iFieldType = DF_TEXT)) Begin Set ComBackColor of hoGridItemMetrics to clRed End End_Procedure End_Object Function DescribeFieldtype Integer iFieldType Returns String String sMessage If (iFieldType = DF_ASCII) Move "ASC" to sMessage If (iFieldType = DF_BCD) Move "NUM" to sMessage If (iFieldType = DF_DATE) Move "DATE" to sMessage If (iFieldType = DF_TEXT) Move "TEXT" to sMessage If (iFieldType = DF_BINARY) Move "BIN" to sMessage If (iFieldType = DF_OVERLAP) Move "OVLP" to sMessage Function_Return sMessage End_Function Procedure DoLoadData String[] sRecord Integer iNoOfFields iActPos Integer iFielddescriptionCol iContentsCol iFieldType iFieldLng iFieldComma Integer lcif rcif String sDescribe strtemp tDataSourceRow[] lsData Get psRecord to sRecord Get piColumnId of oFielddescription to iFielddescriptionCol Get piColumnId of oContents to iContentsCol Get pDataNumFields to iNoOfFields For iActPos From 1 to iNoOfFields Get String_value of aFilDef item (iActPos * 4) to sDescribe Get integer_value of aFilDef item ((iActPos * 4) + 1) to iFieldType Get DescribeFieldtype iFieldType to strTemp Append sDescribe ", " strtemp Get integer_value of aFilDef item ((iActPos * 4) + 2) to iFieldLng Append sDescribe ", " iFieldLng If (iFieldType = DF_BCD) Begin Get integer_value of (afildef(Self)) item ((iActPos * 4) + 3) to iFieldComma Move (iFieldLng - iFieldComma) to lcif Move iFieldComma to rcif Append sDescribe " (" lcif "," rcif ")" End Move sDescribe to lsData[iActPos-1].sValue[iFielddescriptionCol] Move sRecord[iActPos] to lsData[iActPos-1].sValue[iContentsCol] Loop Send InitializeData lsData Send MovetoFirstRow Set pbChangedData to False End_Procedure Procedure DoSaveRecord Handle hoDataSource tDataSourceRow[] lsData RowID rwRecord Integer iFile iNoOfFields iCurrentField iContentsCol Boolean bFound Send Request_Save Get phoDataSource to hoDataSource Get DataSource of hoDataSource to lsData Get prwCurrentRecord to rwRecord Get piFileNumber to iFile Get pDataNumFields to iNoOfFields Get piColumnId of oContents to iContentsCol Clear iFile Move (FindByRowId(iFile, rwRecord)) to bFound If (bFound) Begin Reread iFile For iCurrentField from 1 to iNoOfFields Set_Field_Value iFile iCurrentField to lsData[iCurrentField-1].sValue[iContentsCol] Loop SaveRecord iFile Unlock Send DoPageRefresh of oEditorView Send Close_panel End End_Procedure Procedure Activating Forward Send Activating Send DoLoadData End_Procedure On_Key kSave_Record Send DoSaveRecord End_Object End_Object Object oClose is a Button Set Label to "Close" Set Location to 234 321 Set peAnchors to anBottomRight Procedure OnClick Send Close_panel End_Procedure End_Object On_Key kCancel Send close_panel Procedure Close_panel Integer iNo iLeaveNoAsk If (pbChangedData(Self)) Begin Get confirm "Abandon all changes?" to iNo If not iNo Forward Send close_panel End Else Forward Send close_panel End_Procedure Procedure DoEditRow String[] sRowData RowID rwCurrentRow Set psRecord to sRowData Set prwCurrentRecord to rwCurrentRow Send Popup End_Procedure End_Object