Use Windows.pkg Use dfCmbFrm.pkg Use ChooseField.dg Object EditIndexes Is A ModalPanel Property Boolean pbIndexChanged public False Set Border_Style To Border_Thick Set Label To "Edit Indexes" Set Location To 10 8 // Visual DataFlex 14.0 Client Size Adjuster, modified May 7, 2008: 13:11:32 // Set Size To 257 333 Set Size to 240 326 // Visual DataFlex 14.0 Client Size Adjuster, modified May 7, 2008: 13:11:32 // Set piMaxSize To 600 342 // Visual DataFlex 14.0 Client Size Adjuster, modified May 7, 2008: 13:11:32 // Set piMinSize To 104 217 Set piMinSize to 120 300 Object cmbIndex Is A ComboForm Set Label To "Index:" Set Size To 14 289 Set Location To 9 32 Set peAnchors To anTopLeftRight Set Form_Border To 0 Set Label_Col_Offset To 2 Set Label_Justification_Mode To jMode_Right Set Entry_State Item 0 To False Procedure Combo_Fill_List Integer AntalIndex aktIndex antalSegmenter aktSegment Feltnr iVal String sBesked strTemp Integer iFile Get piFileNumber To iFile Send Combo_delete_data Send Combo_Add_Item "00: (new)" // ingen index - brug recnum Get_Attribute DF_FILE_LAST_INDEX_NUMBER Of iFile To AntalIndex For aktIndex From 1 To antalIndex Get_Attribute DF_INDEX_NUMBER_SEGMENTS Of iFile (String(aktIndex)) To antalSegmenter If antalSegmenter Begin Move "" To sBesked If (aktIndex < 10) Append sBesked "0" Append sBesked aktIndex Append sBesked ": " For aktSegment From 1 To antalSegmenter Get_Attribute DF_INDEX_SEGMENT_FIELD Of iFile (String(aktIndex)) (String(aktSegment)) To feltnr Get string_value Of (aFildef(Self)) Item (feltnr * 4) To strTemp Append sBesked strTemp //Get_attribute DF_INDEX_SEGMENT_CASE of iFile (string(aktIndex)) (string(aktSegment)) to iVal //If (iVal = DF_CASE_USED) append sBesked "(UPP)" Get_Attribute DF_INDEX_SEGMENT_DIRECTION Of iFile (String(aktIndex)) (String(aktSegment)) To iVal If (iVal = DF_DESCENDING) Append sBesked "(DEC)" Append sBesked ", " Loop Trim sBesked To sBesked If (Right(sBesked, 1) = ",") Move (Left(sBesked, (Length(sBesked) - 1))) To sBesked Send Combo_Add_Item sBesked End Loop // Set pIndexChangeOk To False Set value Item 0 To "00: (new)" // Set pIndexChangeOk To True End_Procedure Procedure OnChange // Integer iOk // Get pIndexChangeOk To iOk // If (Not(iOk)) Procedure_Return Send DoFillGrid Of oSegmentGrid End_Procedure End_Object // cmbIndex Object oSegments Is A Group Set Size To 185 314 Set Location To 33 7 Set peAnchors To anAll Set Label To "Segments" Object oSegmentGrid Is A Grid Set Size To 170 302 Set Location To 10 6 Set peAnchors to anAll Set peResizeColumn To rcSelectedColumn Set Line_Width To 3 0 Set Form_Width Item 0 To 196 Set Header_Label Item 0 To "Field" Set Form_Width Item 1 To 47 Set Header_Label Item 1 To "Uppercase" Set Form_Width Item 2 To 47 Set Header_Label Item 2 To "Decending" On_Key Key_F4 Send Prompt On_Key key_F11 Send DoInsertBlankRow On_Key Key_Shift+Key_F2 Send DoDeleteRow Set select_mode To multi_select Procedure DoFillGrid Integer iRow iMaxRows iItem iCounter aktIndex antalSegmenter aktSegment Integer feltnr iVal iOldState iFile String sValue Get piFileNumber To iFile Get dynamic_update_state To iOldState Set dynamic_update_state To False Send Delete_data Move 16 To iMaxRows Move 0 To iCounter Get value Of cmbIndex Item 0 To sValue Left sValue To aktIndex 2 If (aktIndex > 0) Get_Attribute DF_INDEX_NUMBER_SEGMENTS Of iFile (String(aktIndex)) To antalSegmenter If antalSegmenter Begin For aktSegment From 1 To antalSegmenter Get_Attribute DF_INDEX_SEGMENT_FIELD Of iFile (String(aktIndex)) (String(aktSegment)) To feltnr Get string_value Of (aFildef(Self)) Item (feltnr * 4) To sValue Send Add_Item msg_none sValue Get item_count To iItem Decrement iItem Set Form_button Item iItem To Form_Button_prompt Set Form_button_value Item iItem To "..." Get_Attribute DF_INDEX_SEGMENT_CASE Of iFile (String(aktIndex)) (String(aktSegment)) To iVal Send Add_Item msg_none "" Get item_count To iItem Decrement iItem Set checkbox_item_state iItem To True Set select_state Item iItem To iVal // If (iVal = DF_CASE_USED) Append sBesked "(UPP)" Get_Attribute DF_INDEX_SEGMENT_DIRECTION Of iFile (String(aktIndex)) (String(aktSegment)) To iVal Send Add_Item msg_none "" Get item_count To iItem Decrement iItem Set checkbox_item_state iItem To True Set select_state Item iItem To iVal // If (iVal = DF_DESCENDING) Append sBesked "(DEC)" Loop End For iRow From (AntalSegmenter+1) To iMaxRows Send Add_Item msg_none "" Get item_count To iItem Decrement iItem Set Form_button Item iItem To Form_Button_prompt Set Form_button_value Item iItem To "..." Send Add_Item msg_none "" Get item_count To iItem Decrement iItem Set checkbox_item_state iItem To True Send Add_Item msg_none "" Get item_count To iItem Decrement iItem Set checkbox_item_state iItem To True Loop Set dynamic_update_state To iOldState Set checked_State Of oBatchIndex To False Get_Attribute DF_INDEX_TYPE Of iFile (String(aktIndex)) To iVal If (iVal = DF_INDEX_TYPE_BATCH) Set checked_State Of oBatchIndex To True End_Procedure // DoFillGrid Procedure Prompt Integer iCell iColumn iField iMode String sFieldname sMode Get Current_item To iCell Get Current_col To iColumn Case Begin Case (iColumn = 0) // Choose field Send Popup To oChooseField Get piChoosedField Of oChooseField To iField If (iField > -1) Begin Get String_value Of aFilDef Item (iField * 4) To sFieldname Set value Item iCell To sFieldname End Case Break Case End End_Procedure Procedure DoInsertBlankRow Integer iOldState iCell iCol iBaseCell iError Get dynamic_update_state To iOldState Set dynamic_update_state To False Get current_item To iCell Get current_col To iCol Move (iCell - iCol) To iBaseCell Send Insert_Item msg_None "" iBaseCell Send Insert_Item msg_None "" iBaseCell Send Insert_Item msg_None "" iBaseCell Set Form_button Item iBaseCell To Form_Button_prompt Set Form_button_value Item iBaseCell To "..." Set value Item iBaseCell To "" Set checkbox_item_state (iBaseCell + 1) To True Set checkbox_item_state (iBaseCell + 2) To True Get item_count To iCell Decrement iCell Send Delete_Item iCell Decrement iCell Send Delete_Item iCell Decrement iCell Send Delete_Item iCell Get msg_Activate_Item iBaseCell To iError Set dynamic_update_state To iOldState End_Procedure Procedure DoDeleteRow Integer iOldState iCell iCol iBaseCell iError iItem Get dynamic_update_state To iOldState Set dynamic_update_state To False Get current_item To iCell Get current_col To iCol Move (iCell - iCol) To iBaseCell Send Delete_Item iBaseCell Send Delete_Item iBaseCell Send Delete_Item iBaseCell Send Add_Item msg_none "" Get item_count To iItem Decrement iItem Set Form_button Item iItem To Form_Button_prompt Set Form_button_value Item iItem To "..." Send Add_Item msg_none "" Get item_count To iItem Decrement iItem Set checkbox_item_state iItem To True Send Add_Item msg_none "" Get item_count To iItem Decrement iItem Set checkbox_item_state iItem To True Get msg_Activate_Item iBaseCell To iError Set dynamic_update_state To iOldState End_Procedure End_Object // oSegmentGrid End_Object // oSegments Object oBatchIndex Is A CheckBox Set Label To "Index is a BATCH index." Set Size To 10 93 Set Location To 223 7 Set peAnchors to anBottomLeft Procedure OnChange Boolean bChecked Get Checked_State To bChecked End_Procedure // OnChange End_Object // oBatchIndex Object oDelete Is A Button Set Label To "Delete" Set Location To 223 156 Set peAnchors to anBottomRight Procedure OnClick String sValgtFil sValue sField Handle hFile Integer iIndex iBaseCell iMaxCell iSegment iField iValue iFile Integer iRet iFile2 Get piFileNumber To iFile2 Get value Of cmbIndex Item 0 To sValue Left sValue To iIndex 2 If (iIndex = 0) Procedure_Return Get NextFreeFilenumber iFile2 To iFile If (iFile = 0) Procedure_Return Get yesno_box ("Delete index"*String(iIndex)+"?") To iRet If (iRet = MBR_NO) Procedure_Return Close iFile2 Get psFilename To sValgtFil Get DriverForOpenAs sValgtFil To sValgtFil Open sValgtFil as iFile Mode DF_EXCLUSIVE If (Found) Begin Send activate To resinfo Move iFile To hFile Structure_Start hFile If (iIndex > 0) Delete_Index hFile iIndex Structure_End hFile DF_STRUCTEND_OPT_NONE "" (Resinfo(Self)) Send Close_panel To resinfo End Close iFile Set pbIndexChanged To True Send Close_Panel End_Procedure // OnClick End_Object // oDelete Object oSave Is A Button Set Label To "Save" Set Location To 223 213 Set peAnchors to anBottomRight Procedure OnClick String sValgtFil sValue sField Handle hFile Integer iIndex iBaseCell iMaxCell iSegment iField iValue iFile iFile2 Get NextFreeFilenumber To iFile If (iFile = 0) Procedure_Return Get piFileNumber To iFile2 Close iFile2 Get psFilename To sValgtFil Get DriverForOpenAs sValgtFil To sValgtFil Open sValgtFil as iFile Mode DF_EXCLUSIVE If (Found) Begin Send activate To resinfo Move iFile To hFile Structure_Start hFile Get value Of cmbIndex Item 0 To sValue Left sValue To iIndex 2 Get item_count Of oSegmentGrid To iMaxCell Decrement iMaxCell Move 0 To iBaseCell Move 0 To iSegment If (iIndex = 0) Create_Index hFile At iIndex Set_Attribute DF_INDEX_NUMBER_SEGMENTS Of hFile iIndex To 16 Repeat Get value Of oSegmentGrid Item iBaseCell To sField Move (Trim(Uppercase(sField))) To sField Move -1 To iField If (sField <> "") Field_Map hFile sField To iField If (iField <> -1) Begin Increment iSegment Set_Attribute DF_INDEX_SEGMENT_CASE Of hFile iIndex iSegment To DF_CASE_USED Set_Attribute DF_INDEX_SEGMENT_DIRECTION Of hFile iIndex iSegment To DF_ASCENDING Set_Attribute DF_INDEX_SEGMENT_FIELD Of hFile iIndex iSegment To iField Get select_state Of oSegmentGrid Item (iBaseCell + 1) To iValue If (iValue) Set_Attribute DF_INDEX_SEGMENT_CASE Of hFile iIndex iSegment To DF_CASE_IGNORED Get select_state Of oSegmentGrid Item (iBaseCell + 2) To iValue If (iValue) Set_Attribute DF_INDEX_SEGMENT_DIRECTION Of hFile iIndex iSegment To DF_DESCENDING End Move (iBaseCell + 3) To iBaseCell Until (iBaseCell > iMaxCell) Set_Attribute DF_INDEX_NUMBER_SEGMENTS Of hFile iIndex To iSegment Set_Attribute DF_INDEX_TYPE Of hFile iIndex To DF_INDEX_TYPE_ONLINE Get checked_State Of oBatchIndex To iValue If (iValue) Set_Attribute DF_INDEX_TYPE Of hFile iIndex To DF_INDEX_TYPE_BATCH Structure_End hFile DF_STRUCTEND_OPT_NONE "" (Resinfo(Self)) Open sValgtFil as iFile Mode DF_EXCLUSIVE Sort iFile (String(iIndex)) ((DF_SORT_OPTION_BAD_DATA_FIXUP) Ior (DF_SORT_OPTION_DUP_DATA_ABORT)) (Resinfo(Self)) Send Close_panel To resinfo End Close iFile Set pbIndexChanged To True Send Close_Panel End_Procedure // OnClick End_Object // oSave Object oCancel_btn Is A Button Set Label To "&Close" Set Location To 223 269 Set peAnchors To anBottomRight Procedure OnClick Send Close_Panel End_Procedure // OnClick End_Object // oCancel_btn On_Key kCancel Send close_panel Procedure activate_group Forward Send activate_group Set pbIndexChanged To False Send Combo_Fill_List Of cmbIndex End_Procedure End_Object // EditIndexes