//AB/ Project Filter setup //AB/ Object prj is a Dialog_Project //AB/ Set Size to 142 261 //AB/ Set ProjectName to "Filter setup" //AB/ Set ProjectFileName to "FilterSetup.dg" //AB/ Set GenerateFileName to "NONAME" // Project Object Structure // oFilterSetup is a ModalPanel // oFilterliste is a Grid // oOK_btn is a Button // oCancel_btn is a Button // Register all objects Register_Object oCancel_btn Register_Object oFilterliste Register_Object oFilterSetup Register_Object oOK_btn //AB-StoreTopStart Use ChooseField.dg Use Mode.dg //AB-StoreTopEnd //AB-IgnoreStart Use Windows.pkg //AB-IgnoreEnd Object oFilterSetup is a ModalPanel //AB-StoreTopStart Property tsFilter[] plsFilter //AB-StoreTopEnd Set Border_Style to Border_Thick Set Minimize_Icon to FALSE Set Label to "Filter setup" Set Location to 2 3 Set Size to 108 245 Set piMinSize to 104 217 //AB-DDOStart //AB-DDOEnd Object oFilterliste is a Grid Set Size to 62 229 Set Location to 4 7 Set peAnchors to anAll Set Line_Width to 3 0 Set Form_Width item 0 to 99 Set Header_Label item 0 to "Field" Set Form_Width item 1 to 47 Set Header_Label item 1 to "Mode" Set Form_Width item 2 to 72 Set Header_Label item 2 to "Value" //AB-StoreStart On_Key kEnter Send KeyAction of oOK_btn On_Key key_F11 Send DoInsertBlankRow On_Key Key_Shift+Key_F2 Send DoDeleteRow On_Key Key_F4 Send Prompt // Show the current filterset. // Start with minimum 20 lines to work with. Procedure DoFillGrid Integer iRow iMaxRows iItem iCounter String sValue Integer iOldState tsFilter[] lsFilter Get plsFilter to lsFilter Get Dynamic_update_state to iOldState Set Dynamic_Update_state to False Send Delete_data Move (SizeOfArray(lsFilter)) to iCounter Move 19 to iMaxRows Move -1 to iItem For iRow From 0 to iMaxRows If (iRow < iCounter) Begin Send Add_Item msg_none lsFilter[iRow].sField Increment iItem Set Form_button Item iItem to Form_Button_prompt Set Form_button_value Item iItem to "..." Send Add_item msg_none lsFilter[iRow].sMode Increment iItem Set Form_button Item iItem to Form_Button_prompt Set Form_button_value Item iItem to "..." Send Add_item msg_none lsFilter[iRow].sValue Increment iItem End Else Begin Send Add_Item Msg_None "" Increment iItem Set Form_button Item iItem to Form_Button_prompt Set Form_button_value Item iItem to "..." Send Add_Item Msg_None "" Increment iItem Set Form_button Item iItem to Form_Button_prompt Set Form_button_value Item iItem to "..." Send Add_Item Msg_None "" Increment iItem End Loop Set Dynamic_update_state to iOldState End_Procedure // DoFillGrid // if a cell's Form_button is set to Form_Button_prompt, // pressing the button will call this method 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 (iColumn = 1) // Choose mode Send Popup to oMode Get piSelectedMode of oMode to iMode If (iMode <> -1) Begin Get FilterMode iMode to sMode Set value Item iCell to sMode 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 Form_button Item (iBaseCell + 1) to Form_Button_prompt Set Form_button_value Item (iBaseCell + 1) to "..." Set value Item iBaseCell to "" Set value Item (iBaseCell + 1) to "" Set value Item (iBaseCell + 2) to "" 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 Get msg_Activate_Item iBaseCell to iError Set dynamic_update_state to iOldState End_Procedure //AB-StoreEnd End_Object // oFilterliste Object oOK_btn is a Button Set Label to "&OK" Set Location to 70 126 Set peAnchors to anBottomRight //AB-StoreStart Procedure OnClick String sValue Integer iMaxItems iItem iCounter tsFilter[] lsFilter Get item_count of oFilterliste to iMaxItems Move 0 to iItem Move 0 to iCounter While (iItem < iMaxItems) Get value of oFilterliste Item iItem to sValue Move (Trim(Uppercase(sValue))) to sValue If (sValue <> "") Begin Move sValue to lsFilter[iCounter].sField Increment iItem Get value of oFilterliste Item iItem to sValue Move (Trim(Uppercase(sValue))) to lsFilter[iCounter].sMode Increment iItem Get value of oFilterliste Item iItem to sValue Move (Trim(sValue)) to lsFilter[iCounter].sValue Increment iCounter Increment iItem End Else Begin Move (iItem + 3) to iItem End Loop Set plsFilter to lsFilter Send Close_Panel End_Procedure // OnClick //AB-StoreEnd End_Object // oOK_btn Object oCancel_btn is a Button Set Label to "&Cancel" Set Location to 70 185 Set peAnchors to anBottomRight //AB-StoreStart Procedure OnClick Send Close_Panel End_Procedure // OnClick //AB-StoreEnd End_Object // oCancel_btn //AB-StoreStart On_Key kCancel Send close_panel Procedure Activate_group Forward Send activate_group Send DoFillGrid of oFilterliste End_Procedure //AB-StoreEnd End_Object // oFilterSetup //AB-StoreStart //AB-StoreEnd //AB/ End_Object // prj