//------------------------------------------------------------> // GlbFieldList.dg // // List of all fields for the selected data file //------------------------------------------------------------> // Register all objects Register_Object field_list Register_Object OCancel_bn Register_Object OOK_bn Register_Object oFieldLookUp Use Windows.pkg //---------------------------------------------------------------> // strip file_name from string //---------------------------------------------------------------> Function strip_field String sField_string Returns String String sTemp_string Integer iDot_location iLen Move (Trim(sField_string)) to sField_string Move (length(sField_string)) to iLen Move (Pos(".", sField_string)) to iDot_location Move sField_string to sTemp_string If iDot_location Begin Move (right(sField_string,(iLen-iDot_location))) to sTemp_string End Function_Return sTemp_string End_Function CD_Popup_Object oFieldLookUp is a ModalPanel //---------------------------------------------> //- Used in Move_value_out //---------------------------------------------> Property Integer piDidAlready Public 0 On_Key KEnter Send KeyEnter On_Key KCancel Send Close_Panel Procedure KeyEnter Send Move_Value_Out To (Field_list(Self)) End_Procedure Set Label to "Fields" Set Location to 5 6 // Visual DataFlex 14.0 Client Size Adjuster, modified April 22, 2008: 20:37:23 // Set Size to 156 133 Set Size to 141 129 Object field_list is a List Set Size to 102 114 Set Location to 6 7 Procedure Activating Forward Send Activating Send delete_data Send load_list End_Procedure Procedure Mouse_Click Integer iWin integer iChar Forward Send Mouse_Click iWin iChar Send Move_value_out End_Procedure Procedure Load_List // Load the list from Name_Array String sField_Name Integer iCount iField# Set piDidAlready to 0 Move (SizeOfArray(sNameArray)) to iCount For iField# from 0 to (iCount - 1) Move sNameArray[iField#][0] to sField_Name Get strip_Field sField_Name to sField_Name If (sField_Name <> "") Send add_item msg_none sField_Name Loop send sort_items ascending End_Procedure Procedure Move_value_out Integer iField_Obj iCI iField# string sNeed sTemp_String sFieldName sLongName //--------------------------------------------------------------------> // For some unfathomable reason double clicking on a list where // procedure Mouse_click is used seems to fire this procedure twice. // Ordinarily this wouldn't be a problem except that we permit multiple // selections from this list to concatinate in the main view so that // we can "and" or "or" the various selections. //--------------------------------------------------------------------> If (piDidAlready(Self) = 1) Procedure_Return Set piDidAlready to 1 //--------------------------------------------------------------------> //- Get the calling object Id //--------------------------------------------------------------------> Get piCurrent_Field_Obj Of (oReplace_View(Self)) To iField_Obj //--------------------------------------------------------------------> //- Get the current name from the list //--------------------------------------------------------------------> Get Current_Item To iCI Get Value Item iCI To sFieldName //--------------------------------------------------------------------> //- Get the field number from the name //--------------------------------------------------------------------> Field_Map filenumber (trim(sFieldName)) to iField# //--------------------------------------------------------------------> // Special handling to set field name and field number // In this section we only need the field name, not the file name. // In the Else section we need the file name too. // The reason is one of the entry fields requires the whole file.field // name, the other just needs the field name. //--------------------------------------------------------------------> Get psNeed_Fld# Of (oReplace_View(Self)) To sNeed IF (sNeed = "Y") Begin Set Value Of (oSel_Field_Numb(oReplace_View(Self))) Item 0 to iField# Set Value of iField_Obj item 0 to (trim(sFieldName)) End //--------------------------------------------------------------------> // Here we concatinate items in case the user wants to "and" them //--------------------------------------------------------------------> else Begin Move (psFileName(Self) + "." + sFieldName) to sLongName Get piCurrent_Field_Obj Of (oReplace_View(Self)) To iField_Obj Get Value of iField_Obj item 0 to sTemp_String Set Value of iField_Obj item 0 to (trim(sTemp_String)+" "+sLongName) Set piReplField# to iField# End Send Close_Panel End_Procedure End_Object // field_list Object OOK_bn is a Button Set Label to "&Ok" Set Location to 113 16 Procedure OnClick Send Move_Value_Out to (Field_list(Self)) End_Procedure End_Object // OOK_bn Object OCancel_bn is a Button Set Label to "&Cancel" Set Location to 113 71 Procedure OnClick Send Close_Panel End_Procedure End_Object // OCancel_bn CD_End_Object // oFieldLookUp