//AB/ Project Choose columns to show //AB/ Object prj is a Dialog_Project //AB/ Set ProjectName to "Choose columns to show" //AB/ Set ProjectFileName to "ColumnFilter.dg" //AB/ Set GenerateFileName to "NONAME" //AB/ Set Size to 356 236 // Project Object Structure // oColumnFilter_dg is a ModalPanel // oFieldList is a Grid // oAll_bn is a Button // oOK_btn is a Button // oCancel_btn is a Button // Register all objects Register_Object oAll_bn Register_Object oCancel_btn Register_Object oColumnFilter_dg Register_Object oFieldList Register_Object oOK_btn //AB-IgnoreStart Use Windows.pkg //AB-IgnoreEnd Object oColumnFilter_dg is a ModalPanel Set Border_Style to Border_Thick Set Label to "Choose columns to show in grid" Set Location to 2 3 Set Size to 152 175 Set piMaxSize to 152 175 Set piMinSize to 152 175 //AB-DDOStart //AB-DDOEnd Object oFieldList is a Grid Set Size to 101 156 Set Location to 4 7 Set peAnchors to anAll Set GridLine_Mode to GRID_VISIBLE_NONE Set Line_Width to 1 0 Set Form_Width Item 0 to 148 Set Header_Label Item 0 to "Field" //AB-StoreStart Set Select_mode to Multi_select On_Key kEnter Send keyAction of oOK_btn Procedure DoFillList Integer iAntalFelter iItem iField iListItem iFieldtype Integer iOldState iSelected iStartField String sFieldname Get dynamic_update_state to iOldState Set dynamic_update_state to False Send cursor_wait of cursor_control Send Delete_data // Fill the list by sending Add_item Get pDataNumFields to iAntalFelter Get FirstFieldnumber to iStartField For iItem From iStartField to iAntalFelter Move iItem to iField Get String_value of aFilDef Item (iField * 4) to sFieldname Get integer_value of aFildef Item ((iField * 4) + 1) to iFieldType If (iFieldType <> DF_OVERLAP) Begin Send Add_Item Msg_None sFieldname Get item_count to iListItem Decrement iListItem Set aux_value Item iListItem to iField Set Entry_State Item iListItem to False Get Find_element of aColumnFilters iField to iSelected If (iSelected <> -1) Set select_state Item iListItem to True End Loop Send Sort_Items ascending Set dynamic_update_state to iOldState Send cursor_ready of cursor_control End_Procedure // DoFillList // Send DoFillList // message must be sent to fill the list //Procedure OnChange // Integer iCurrent // // Get Current_Item To iCurrent // item number of current item //End_Procedure // OnChange //AB-StoreEnd End_Object // oFieldList Object oAll_bn is a Button Set Label to "Clear all" Set Size to 14 51 Set Location to 114 5 //AB-StoreStart Procedure OnClick Set Select_Count of oFieldList to False Send KeyAction of oOK_btn End_Procedure // OnClick //AB-StoreEnd End_Object // oAll_bn Object oOK_btn is a Button Set Label to "&OK" Set Location to 114 59 Set peAnchors to anBottomRight //AB-StoreStart Procedure OnClick Integer iItem iField iMax iArrayItems String sField Boolean bSelected Send Delete_data of aColumnFilters Get item_count of oFieldList to iMax Decrement iMax For iItem From 0 to iMax Get select_state of oFieldList Item iItem to bSelected If (bSelected = True) Begin Get aux_value of oFieldList Item iItem to iField Get item_count of aColumnFilters to iArrayItems Set array_value of aColumnFilters Item iArrayItems to iField End Loop Set piChoosedField to 0 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 114 114 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 Set visible_state to False Forward Send Activate_group Set piChoosedField to -1 Send DoFillList of oFieldList Set visible_state to True End_Procedure //AB-StoreEnd End_Object // oColumnFilter_dg //AB-StoreStart //AB-StoreEnd //AB/ End_Object // prj