Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix table editing redraw code on all platforms. #507

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/tablemodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ void uiprivTableModelSetCellValue(uiTableModel *m, int row, int column, const ui

mh = uiprivTableModelHandler(m);
(*(mh->SetCellValue))(mh, m, row, column, value);

uiTableModelRowChanged(m, row);
}

const uiTableTextColumnOptionalParams uiprivDefaultTextColumnOptionalParams = {
Expand Down
7 changes: 0 additions & 7 deletions darwin/tablecolumn.m
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,6 @@ - (IBAction)uiprivOnTextFieldAction:(id)sender
value = uiNewTableValueString([[self->tf stringValue] UTF8String]);
uiprivTableModelSetCellValue(self->m, row, self->textModelColumn, value);
uiFreeTableValue(value);
// always refresh the value in case the model rejected it
// TODO document that we do this, but not for the whole row (or decide to do both, or do neither...)
[self uiprivUpdate:row];
}

- (IBAction)uiprivOnCheckboxAction:(id)sender
Expand All @@ -306,8 +303,6 @@ - (IBAction)uiprivOnCheckboxAction:(id)sender
value = uiNewTableValueInt([self->cb state] != NSOffState);
uiprivTableModelSetCellValue(self->m, row, self->checkboxModelColumn, value);
uiFreeTableValue(value);
// always refresh the value in case the model rejected it
[self uiprivUpdate:row];
}

@end
Expand Down Expand Up @@ -539,8 +534,6 @@ - (IBAction)uiprivOnClicked:(id)sender

row = [self->t->tv rowForView:self->b];
uiprivTableModelSetCellValue(self->m, row, self->modelColumn, NULL);
// TODO document we DON'T update the cell after doing this
// TODO or decide what to do instead
}

@end
Expand Down
10 changes: 0 additions & 10 deletions windows/tableediting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ HRESULT uiprivTableFinishEditingText(uiTable *t)
p = (*(t->columns))[t->editedSubitem];
uiprivTableModelSetCellValue(t->model, t->editedItem, p->textModelColumn, value);
uiFreeTableValue(value);
// always refresh the value in case the model rejected it
if (SendMessageW(t->hwnd, LVM_UPDATE, (WPARAM) (t->editedItem), 0) == (LRESULT) (-1)) {
logLastError(L"LVM_UPDATE");
return E_FAIL;
}
return uiprivTableAbortEditingText(t);
}

Expand Down Expand Up @@ -250,11 +245,6 @@ HRESULT uiprivTableHandleNM_CLICK(uiTable *t, NMITEMACTIVATE *nm, LRESULT *lResu
uiFreeTableValue(value);
} else
uiprivTableModelSetCellValue(t->model, ht.iItem, modelColumn, NULL);
// always refresh the value in case the model rejected it
if (SendMessageW(t->hwnd, LVM_UPDATE, (WPARAM) (ht.iItem), 0) == (LRESULT) (-1)) {
logLastError(L"LVM_UPDATE");
return E_FAIL;
}

done:
*lResult = 0;
Expand Down