//TH-Header //***************************************************************************************** // Copyright (c) 2014 KURANT Project // All rights reserved. // // $FileName : agt.DG // $ProjectName : The Hammer 2.0 // $Authors : Wil van Antwerpen, Michael Kurz, Sergey V. Natarov, Bernhard Ponemayr // $Created : 01.25.2014 01:08 // $Type : LGPL // // Contents: Active Grid Tune Dialog // Customize Table // //***************************************************************************************** //TH-RevisionStart //TH-RevisionEnd // Project Object Structure // oAGTD is a dbModalPanel // oOK_bn is a Button // oCancel_bn is a Button // List1 is a List // List2 is a List // FldSz is a array // FldTag is a array // oUP is a Button // oDN is a Button // oRgt is a Button // oRgtAll is a Button // oLft is a Button // oLftAll is a Button // oLbl is a Form // oSz is a SpinForm // CheckBox1 is a CheckBox // ComboForm1 is a ComboForm // oTag is a Form // Register all objects Register_Object CheckBox1 Register_Object ComboForm1 Register_Object FldSz Register_Object FldTag Register_Object List1 Register_Object List2 Register_Object oAGTD Register_Object oCancel_bn Register_Object oDN Register_Object oLbl Register_Object oLft Register_Object oLftAll Register_Object oOK_bn Register_Object oRgt Register_Object oRgtAll Register_Object oSz Register_Object oTag Register_Object oUP Object oAGTD Is a dbModalPanel #IF (!@ >= 140) Set pbSizeToClientArea to False #ENDIF Property Integer piGridFile Public 0 Set Label To "Customize Table" Set Size to 169 324 Set Location To 18 53 Object oOK_bn Is a Button Set Label To "&OK" Set Location To 135 132 Procedure OnClick Integer iCnt iFile iItm iFld iSz String sFile sPath sAGT sLbl sTag Get piGridFile Of oAGTD To iFile Get_Attribute DF_FILE_PHYSICAL_NAME Of iFile To sFile #IF (FMAC_VERSION < 8) Get CurrentDataPath Of ghoWorkspace To sPath #ELSE Get CurrentDataPath Of (phoWorkspace(ghoApplication)) To sPath #ENDIF Move (sPath+"\"+sFile+".agt") To sAGT Get Item_Count Of List2 To iCnt Decrement iCnt Direct_Output sAgt // Visible list first = 1 If (iCnt>0) Begin For iItm From 0 To iCnt Get value Of List2 Item iItm To sLbl Get Aux_Value Of List2 Item iItm To iFld Get Value Of (FldSz(List2(Self))) Item iFld To iSz Get Value Of (FldTag(List2(Self))) Item iFld To sTag // Visible //Order Writeln 1 "," iFld "," (ToOEM(sLbl)) "," sTag "," iSz Loop End // Hidden columns Get Item_Count Of List1 To iCnt Decrement iCnt If (iCnt>0) Begin For iItm From 0 To iCnt Get value Of List1 Item iItm To sLbl Get Aux_Value Of List1 Item iItm To iFld Get Value Of (FldSz(List2(Self))) Item iFld To iSz Get Value Of (FldTag(List2(Self))) Item iFld To sTag // Hidden //Order Writeln 0 "," iFld "," (ToOEM(sLbl)) "," sTag "," iSz Loop End Close_Output Send Close_Panel End_Procedure End_Object // oOK_bn Object oCancel_bn Is a Button Set Label To "&Cancel" Set Location To 135 189 Procedure OnClick Send Close_Panel End_Procedure End_Object // oCancel_bn Object List1 Is a List Set Label To "Hidden Columns:" Set Size To 122 107 Set Location To 10 4 Set Label_Col_Offset To -4 Set Border_Style To BORDER_NORMAL Set Label_Justification_Mode To jMode_Top End_Object // List1 Object List2 Is a List Object FldSz Is an array End_Object Object FldTag Is an array End_Object Set Label To "Visible Columns:" Set Size To 122 107 Set Location To 10 132 Set Label_Col_Offset To -4 Set Border_Style To BORDER_NORMAL Set Label_Justification_Mode To jMode_Top Procedure item_change Integer fromi Integer toi Returns Integer Integer rval iAux iSz iFile String sLbl sFile Forward Get msg_item_change fromi toi To rval Get piGridFile Of oAGTD To iFile Get_Attribute DF_FILE_PHYSICAL_NAME Of iFile To sFile Get value Item toi To sLbl Get aux_value Item toi To iAux Move (Value(FldSz(Self),iAux)) To iSz Set Value Of oLbl Item 0 To (ToOEM(sLbl)) Set Value Of oSz Item 0 To iSz Set Value Of oTag Item 0 To (Uppercase(sFile)+"."+Value(FldTag(Self),iAux)) Procedure_Return rval End_Procedure Procedure FillVisibleList Integer iFile iFld iSz String sFile sPath sAGT sTAG sTmp sTg Integer iType Send Delete_Data Send Delete_Data To List1 Send Delete_Data To FldSz Send Delete_Data To FldTag Get piGridFile Of oAGTD To iFile Get_Attribute DF_FILE_PHYSICAL_NAME Of iFile To sFile #IF (FMAC_VERSION < 8) Get CurrentDataPath Of ghoWorkspace To sPath #ELSE Get CurrentDataPath Of (phoWorkspace(ghoApplication)) To sPath #ENDIF Move (sPath+"\"+sFile+".agt") To sAGT Move (sPath+"\"+sFile+".tag") To sTAG Direct_Input sAGT Move 1 To iFld If (seqeof) Begin Close_Input Direct_Input sTag While (Not(seqeof)) Readln sTmp If (Trim(sTmp)<>"") Begin Get_Attribute DF_FIELD_LENGTH Of iFile iFld To iSz Move (iSz*3) To iSz If (iSz<10) Move 10 To iSz If (iSz>100) Move 100 To iSz Set Value Of FldSz Item iFld To iSz Set Value Of FldTag Item iFld To sTmp Get Format_Tag sTmp To sTmp Send Add_item 0 sTmp Set Aux_Value Item (Item_Count(Self)-1) To iFld Increment iFld End Loop End Else Begin While (Not(seqeof)) Readln iType iFld sTmp sTg iSz If (iType=1) Begin If (Trim(sTmp)<>"") Begin Send Add_Item 0 (ToANSI(sTmp)) Set Aux_Value Item (Item_Count(Self)-1) To iFld Set Value Of FldSz Item iFld To iSz Set Value Of FldTag Item iFld To sTg End End Else Begin If (Trim(sTmp)<>"") Begin Send Add_Item To List1 0 (ToANSI(sTmp)) Set Aux_Value Of List1 Item (Item_Count(List1(Self))-1) To iFld Set Value Of FldSz Item iFld To iSz Set Value Of FldTag Item iFld To sTg End End Loop // Now fill Tags End Close_Input End_Procedure Function Format_Tag String sTag Returns String String sChr Move (Lowercase(Trim(sTag))) To sTag Move (Left(sTag,1)) To sChr Replace sChr In sTag with (uppercase(sChr)) Function_Return sTag End_Function End_Object // List2 Object oUP Is a Button Set Label To "Button1" Set Bitmap To "up.bmp" Set Size To 7 13 Set Location To 12 242 Procedure OnClick Integer icItm iAux iAuxOld String sLbl sOldLbl Get current_item Of List2 To icItm Set Dynamic_Update_State Of List2 To False If (icItm) Begin Get value Of List2 Item icItm To sLbl Get Aux_Value Of List2 Item icItm To iAux Get value Of List2 Item (icItm-1) To sOldLbl Get Aux_Value Of List2 Item (icItm-1) To iAuxOld Set Value Of List2 Item (icItm-1) To sLbl Set Aux_Value Of List2 Item (icItm-1) To iAux Set Value Of List2 Item icItm To sOldLbl Set Aux_Value Of List2 Item icItm To iAuxOld Set current_item Of list2 To (icItm-1) End Set Dynamic_Update_State Of List2 To True End_Procedure // OnClick End_Object // oUP Object oDN Is a Button Set Label To "Button2" Set Bitmap To "down.bmp" Set Size To 7 13 Set Location To 19 242 Procedure OnClick Integer icItm iAux iAuxOld String sLbl sOldLbl Get current_item Of List2 To icItm Set Dynamic_Update_State Of List2 To False If (icItm<(Item_Count(List2(Self))-1)) Begin Get value Of List2 Item icItm To sLbl Get Aux_Value Of List2 Item icItm To iAux Get value Of List2 Item (icItm+1) To sOldLbl Get Aux_Value Of List2 Item (icItm+1) To iAuxOld Set Value Of List2 Item (icItm+1) To sLbl Set Aux_Value Of List2 Item (icItm+1) To iAux Set Aux_Value Of List2 Item icItm To iAuxOld Set Value Of List2 Item icItm To sOldLbl Set current_item Of list2 To (icItm+1) End Set Dynamic_Update_State Of List2 To True End_Procedure // OnClick End_Object // oDN Object oRgt Is a Button Set Label To ">" Set Size To 14 15 Set Location To 29 114 Procedure OnClick Integer ihItm iVItm iAux String sLbl Get Current_Item Of List1 To iHItm If (Item_Count(List1(Self))) Begin Get Value Of List1 Item ihItm To sLbl Get Aux_Value Of List1 Item ihItm To iAux Send Add_Item To List2 0 sLbl Set Aux_Value Of List2 Item (Item_Count(List2(Self))-1) To iAux Send Delete_Item To List1 ihItm End End_Procedure // OnClick End_Object // oRgt Object oRgtAll Is a Button Set Label To ">>" Set Size To 14 15 Set Location To 44 114 Procedure OnClick Integer iItm iCnt iAux String sLbl Get Item_Count Of List1 To iCnt For iItm From 0 To (iCnt-1) Get Value Of List1 Item iItm To sLbl Get Aux_Value Of List1 Item iItm To iAux Send Add_Item To List2 0 sLbl Set Aux_Value Of List2 Item (Item_Count(List2(Self))-1) To iAux Loop Send Delete_Data To List1 End_Procedure // OnClick End_Object // oRgtAll Object oLft Is a Button Set Label To "<" Set Size To 14 15 Set Location To 66 114 Procedure OnClick Integer iVItm iAux String sLbl Get Current_Item Of List2 To ivItm If (Item_Count(List2(Self))) Begin Get Value Of List2 Item ivItm To sLbl Get Aux_Value Of List2 Item ivItm To iAux Send Add_Item To List1 0 sLbl Set Aux_Value Of List1 Item (Item_Count(List1(Self))-1) To iAux Send Delete_Item To List2 ivItm End End_Procedure // OnClick End_Object // oLft Object oLftAll Is a Button Set Label To "<<" Set Size To 14 15 Set Location To 81 114 Procedure OnClick Integer iItm iCnt iAux String sLbl Get Item_Count Of List2 To iCnt For iItm From 0 To (iCnt-1) Get Value Of List2 Item iItm To sLbl Get Aux_Value Of List2 Item iItm To iAux Send Add_Item To List1 0 sLbl Set Aux_Value Of List1 Item (Item_Count(List1(Self))-1) To iAux Loop Send Delete_Data To List2 End_Procedure // OnClick End_Object // oLftAll Object oLbl Is a Form Set Label To "Column name:" Set Size To 13 73 Set Location To 40 243 Set Label_Col_Offset To 0 Set Label_Justification_Mode To jMode_Top Procedure OnKillFocus Integer iItm Set Dynamic_Update_State Of List2 To False Get Current_Item Of List2 To iItm Set value Of list2 Item iItm To (ToAnsi(value(Self,0))) Set Dynamic_Update_State Of List2 To True End_Procedure End_Object // oLbl Object oSz Is a SpinForm Set Label To "Column width:" Set Size To 13 53 Set Location To 12 261 Set Label_Col_Offset To 0 Set Label_Justification_Mode To jMode_Top Procedure OnKillFocus Integer iSz iItm iAux Get value Item 0 To iSz Get Current_Item Of List2 To iItm Get Aux_Value Of List2 Item iItm To iAux Set Value Of (FldSz(List2(Self))) Item iAux To iSz End_Procedure End_Object // oSz Object CheckBox1 Is a CheckBox Set Enabled_State To False Set Label To "Use ticket" Set Size To 10 49 Set Location To 58 243 End_Object // CheckBox1 Object ComboForm1 Is a ComboForm Set Enabled_State To False Set Size To 13 73 Set Location To 72 243 Procedure Combo_Fill_List Send Combo_Add_Item "" Send Combo_Add_Item "Calc Total" Send Combo_Add_Item "Number Rows" Set Entry_State Item 0 To False End_Procedure End_Object // ComboForm1 Object oTag Is a Form Set Enabled_State To False Set Label To "Primary Field:" Set Size To 13 73 Set Location To 98 243 Set Label_Col_Offset To 0 Set Label_Justification_Mode To jMode_Top End_Object // oTag Procedure PopUp Integer iFile String sFile Set piGridFile To iFile Get_Attribute DF_FILE_DISPLAY_NAME Of iFile To sFile Set Label To ("Customize Table - ("+sFile+")") Send FillVisibleList To List2 Forward Send PopUp End_Procedure End_Object // oAGTD