Openedge 中的 DevExpress - 尽管启用了列但仍无法编辑它

问题描述 投票:0回答:1

我有一个充满数据的临时表,我试图将其显示为 gridView,其中有一列可编辑以更改预算,并且采用数字格式,精确到小数点后两位。它以编程方式添加每一列,而不是使用设计器,因为我也使用其他 gridView 的类,但即使通过视觉设计器添加列也有相同的问题。 gridView 使用视觉设计器给出的所有默认值。有 8 列,格式如下:CHAR、CHAR、DATE、DATE、CHAR、DECI、DECI、CHAR。保存每行数据的类对于每个属性都有 get 和 set 方法。添加列和数据的方法如下:

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.

我遇到的问题是,当触发 ShownEditor 和 ShowingEditor 事件时,特定列的单元格有点陷入只读状态,我可以突出显示单元格条目,但不能更改任何内容。其他列不会触发编辑器,因此可以正常运行。有人对如何使该列可编辑有任何想法吗?

devexpress openedge progress-4gl
1个回答
0
投票

好吧,事实证明这个问题的答案比我想象的要简单得多。您只需在 ShownEditor 事件中将 ActiveEditor 的只读属性设置为 false 即可。我不知道为什么当我在创建存储库项目时将其只读状态设置为 false 时,将其设置为 true,但是哦,好吧:|

METHOD PRIVATE VOID m_gridView_ShownEditor( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
    
    m_gridView:ActiveEditor:ReadOnly = FALSE.
    
END METHOD.
© www.soinside.com 2019 - 2024. All rights reserved.