Search code examples
devexpressopenedgeprogress-4gl

DevExpress in Openedge - Column can't be edited despite enabling it


I've got a temp table full of data that I'm trying to display as a gridView with one column meant to be editable for changing a budget and is in a numeric format to 2 decimal places. It adds each column programmically instead of using the designer since I use the class for other gridViews as well but even adding the columns in by the visual designer has the same issue. The gridView uses all default values given by the visual designer. There are 8 columns in the following formats - CHAR, CHAR, DATE, DATE, CHAR, DECI, DECI, CHAR. The class holding the data for each row have get and set methods for each attribute. The method for adding in the columns and data is below:

METHOD PRIVATE VOID Budgets_LoadContent( p_refresh AS LOGI ):
    
    DEF VAR dataList    AS "List<BudgetsRow>" NO-UNDO.
    DEF VAR l_newRow    AS BudgetsRow         NO-UNDO.
    DEF VAR l_key       AS CHAR               NO-UNDO INITIAL "ROOT".
    DEF VAR l_levelCode AS CHAR               NO-UNDO.
    
    IF NOT p_refresh THEN DO:
        
        m_gridView:OptionsBehavior:Editable = TRUE.
        
        m_gridView:Columns:AddVisible("Code"):OptionsColumn:AllowEdit = FALSE.
        m_gridView:Columns:AddVisible("Description"):OptionsColumn:AllowEdit = FALSE.
        m_gridView:Columns:AddVisible("Start"):OptionsColumn:AllowEdit = FALSE.
        m_gridView:Columns:AddVisible("End"):OptionsColumn:AllowEdit = FALSE.
        m_gridView:Columns:AddVisible("Type"):OptionsColumn:AllowEdit = FALSE.
        m_gridView:Columns:AddVisible("Budget"):OptionsColumn:AllowEdit = TRUE.
        m_gridView:Columns:AddVisible("Actual"):OptionsColumn:AllowEdit = FALSE.
        
        searchCol = m_gridView:Columns:AddVisible("RowID", "RowID").
        searchCol:Visible = FALSE.
        
        ASSIGN columnEditBox = NEW RepositoryItemTextEdit()
               columnEditBox:ReadOnly = FALSE
               columnEditBox:Mask:MaskType = DevExpress.XtraEditors.Mask.MaskType:Numeric
               columnEditBox:Mask:EditMask = "n2"
               columnEditBox:Mask:UseMaskAsDisplayFormat = TRUE
               m_gridView:Columns["Budget"]:ColumnEdit = columnEditBox
               m_gridView:Columns["Actual"]:DisplayFormat:FormatType = DevExpress.Utils.FormatType:Numeric
               m_gridView:Columns["Actual"]:DisplayFormat:FormatString = "n2".
        
    END.
    
    dataList = NEW "List<BudgetsRow>"().
    FOR EACH V-BUDGET:
        
        l_newRow = NEW BudgetsRow ( V-BUDGET.CODE, V-BUDGET.DESC, V-BUDGET.START-DATE,
                                    V-BUDGET.END-DATE,      V-BUDGET.TYPE,        V-BUDGET.BUDGET, 
                                    V-BUDGET.ACTUAL, STRING ( V-BUDGET.TT-ROWID ) ).
        dataList:Add(l_newRow).
        
    END.
    
    m_bindingSource:DataSource = dataList.
    DisableSearch().
    m_gridView:OptionsView:ShowFilterPanelMode = DevExpress.XtraGrid.Views.Base.ShowFilterPanelMode:Never.
    
END METHOD.

The problem I'm having is that while the ShownEditor and ShowingEditor events are triggered, the cells for the specific column are sorta stuck in a read-only state where I can highlight the cell entry but not change anything. The other columns don't trigger the editor and thus functions correctly. Does anyone have any ideas on how I can make the column editable?


Solution

  • Okay, turns out the answer to this is alot more simpler than I thought. You just have to set the ActiveEditor's read-only attribute to false in the ShownEditor event. I don't know why this is set to true when I've set the repositoryitem's read-only state to false when it's created but oh well :|

    METHOD PRIVATE VOID m_gridView_ShownEditor( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
        
        m_gridView:ActiveEditor:ReadOnly = FALSE.
        
    END METHOD.