سؤال

أي شخص يعرف ما إذا كان من الممكن تمكين / تعطيل حقول TextCellEditor الفردية.

على سبيل المثال، إذا كان لدي جدول مع 5 أعمدة، فأنا أريد أن تكون الخلية الأخيرة فارغة ما لم تملأ الحقل رقم 4.

هل كانت مفيدة؟

المحلول

إذا كنت تستخدم فئة EditingSupport، فيمكنك ضبطها canEdit لإعادة صحيح.

TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); 

EditingSupport editingSupport = new EditingSupport(viewer) 
{
    ... implement abstract methods ...

    protected boolean canEdit(Object element)
    {
        return (/* criteria to determine if this column is editable*/)
    } 
}; 

column.setEditingSupport(editingSupport);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top