Use cRDCModalPanel.pkg Use cRDCCJSelectionGrid.pkg Use cRDCButtonDPI.pkg Object oDeleteWorkspaceHistory_dg is a cRDCModalPanel Set Label to "Delete Workspace History Items" Set Size to 158 374 Set Location to 2 2 Set piMinSize to 158 345 Set Icon to "RemoveWorkspaceHistory.ico" Property String[] pasWorkspaces Object oInfo_tb is a TextBox Set Size to 10 100 Set Location to 10 29 Set Label to "Use the spacebar to select items" End_Object Object oWorkspaceHistory_grd is a cRDCCJSelectionGrid Set Size to 109 346 Set Location to 22 14 Set psNoItemsText to "No Workspace selected yet..." Object oCJGridColumnRowIndicator is a cCJGridColumnRowIndicator Set piWidth to 25 End_Object Object oWorkspaceName_col is a cCJGridColumn // This must be here: Set phoData_Col to Self Set piWidth to 602 Set psCaption to "Workspace Name" Set psToolTip to "Workspace history name" Set pbEditable to False End_Object Procedure LoadData String sFolderName Handle hoDataSource tDataSourceRow[] TheData TheDataEmpty tsSearchResult[] asFolderArray Integer iSize iRow iCount iFolderCol iCheckBoxCol String[] asWorkspaces If (not(IsComObjectCreated(Self))) Begin Procedure_Return End Get pasWorkspaces to asWorkspaces Move (SizeOfArray(asWorkspaces)) to iSize If (iSize = 0) Begin Procedure_Return End Move 0 to iCount Decrement iSize Get phoDataSource to hoDataSource Get DataSource of hoDataSource to TheData Move TheDataEmpty to TheData Get piColumnId of (phoData_Col(Self)) to iFolderCol Get piColumnId of (phoCheckbox_Col(Self)) to iCheckBoxCol Move 0 to iRow For iCount From 0 to iSize Move asWorkspaces[iCount] to sFolderName Move sFolderName to TheData[iRow].sValue[iFolderCol] Move False to TheData[iRow].sValue[iCheckBoxCol] Increment iRow Loop If (iRow <> 0) Begin Send ReInitializeData TheData False Send MoveToFirstRow End Else Begin Send InitializeData TheDataEmpty End Get CheckedItems to iCount Set psFooterText of oWorkspaceName_col to ("Selected Items:" * String(iCount)) End_Procedure // We delete selected item(s) in three steps. // 1. Check for selected items and delete them from the grid // 2. Get the remainder of items from the grid to an array string // 3. Delete all current items from the registry and write the new array string. Function DeleteSelectedItems Returns Boolean String[] asWorkspaces Integer iCount iSize iRegistryItems iItem iWorkspaceName_col iCheckbox_Col Handle hoDataSource tDataSourceRow[] TheData NewData Boolean bChecked Move False to Err Get piColumnId of oWorkspaceName_col to iWorkspaceName_col Get piColumnId of oCheckbox_col to iCheckbox_Col Get phoDataSource to hoDataSource Get DataSource of hoDataSource to TheData Move (SizeOfArray(TheData)) to iSize Decrement iSize Move 0 to iItem // 1. Delete selected grid items For iCount From 0 to iSize Move TheData[iCount].sValue[iCheckbox_Col] to bChecked If (bChecked = False) Begin Move TheData[iCount] to NewData[iItem] Increment iItem End Loop Send ReInitializeData NewData False Send MoveToFirstRow // 2. Get the grid data again and move items to string array Get DataSource of hoDataSource to TheData Move (SizeOfArray(TheData)) to iSize Decrement iSize Move 0 to iItem For iCount From 0 to iSize Move TheData[iCount].sValue[iWorkspaceName_col] to asWorkspaces[iItem] Increment iItem Loop // Get max number of workspaces that can be saved to the registry. Get piWorkspaceItems of ghoApplication to iRegistryItems // 3. Delete all current items from the registry and write the new array string, then write the new ones. For iCount From 0 to iRegistryItems Send WriteString of ghoApplication CS_WorkspacesKey (CS_WorkspaceRecentKey + String(iCount)) "" Loop Move (SizeOfArray(asWorkspaces)) to iSize Decrement iSize For iCount From 0 to iSize Send WriteString of ghoApplication CS_WorkspacesKey (CS_WorkspaceRecentKey + String(iCount)) asWorkspaces[iCount] Loop Send DoSetCheckboxFooterText Function_Return (Err = False) End_Function On_Key Key_Space Send ToggleCurrentItem End_Object Object oOK_Btn is a cRDCButtonDPI Set Label to "Delete" Set Location to 137 255 Set peAnchors to anBottomRight Set psImage to "ActionDelete.ico" Procedure OnClick Integer iCount iRetval Boolean bOK Get CheckedItems of oWorkspaceHistory_grd to iCount If (iCount = 0) Begin Send Info_Box "You need to select at least one workspace history item to delete. Please adjust and try again." Procedure_Return End Get YesNo_Box ("Are you sure you want to delete" * String(iCount) * "history workspaces from the registry?") to iRetval If (iRetval <> MBR_Yes) Begin Procedure_Return End Get DeleteSelectedItems of oWorkspaceHistory_grd to bOK If (bOK = True) Begin Send Info_Box "Selected item(s) successfully deleted from the registry" End Else Begin Send Info_Box "Nope, that didn't work. It did not work to delete the selected item(s)." End End_Procedure On_Key kCancel Send KeyAction of oCancel_Btn End_Object Object oCancel_Btn is a Button Set Label to "Close" Set Location to 137 310 Set peAnchors to anBottomRight Procedure OnClick Send Close_Panel End_Procedure On_Key kCancel Send KeyAction of oCancel_Btn End_Object On_Key Key_Alt+Key_O Send KeyAction of oOK_Btn On_Key Key_Alt+Key_C Send KeyAction of oCancel_Btn End_Object Procedure ActivateDeleteWorkspaceHistoryDialog String[] asWorkspaces Handle ho Move (oDeleteWorkspaceHistory_dg(Self)) to ho Set pasWorkspaces of ho to asWorkspaces Send Popup of ho End_Procedure