Icon View Incident Report

Serious Serious
Reported By: Roland Verrinder
Reported On: 10/13/2015
For: Version 2.02 Build 1
# 4266 Updating TListBox Items Not Triggering Proper Data Changes When Bound to a TDataSet

I have a TlistBox linked to a dataset column with a string data type. I also have a TDatasetToolBar linked to the dataset with First, Prior, Next, Last and Save buttons exposed.

I use the list box to provide User-input options appropriate to the value of a second column in the dataset. To do this I create 2 TStrings variables, populate them in the form's initialization and simply assign the appropriate variable to the listbox's items in the dataset's AfterScroll event.

When opening the dataset and scrolling the records all appears to work correctly with the listbox selecting the matching item on the list.

Problem:

I select a different value in the list box and click the Save button to save the record locally (No changes on the server and no dataset event code other than the AfterScroll event above).

I then scroll to a different record and scroll back to the modified one - the item selection bar in the list box (indicating the current value in the underlying column) is absent and the listbox's ItemIndex reports -1 even though the underlying column value reports as correct.

I have worked around this by clearing and resetting the listbox's DataColumn property after the items assignment code in the AfterScroll event above.

procedure TWorkForm.WorkOrderTasksAfterScroll(Sender: TObject);
var
  ExpectedOutcome: string;
begin
  ExpectedOutcome:= WorkOrderTasks.Columns['ExpectedOutcome'].AsString;
  case ExpectedOutcome of
     'Yes','No': TaskOutComeLBox.Items.Assign(Outcomes1);
     'Done and OK': TaskOutComeLBox.Items.Assign(Outcomes2);
  end;{case}
//   TaskOutcomeLBox.DataColumn:= '';
//   TaskOutcomeLBox.DataColumn:= 'TaskOutcome';
  TaskDocumentFile.Visible:= (TaskDocumentFile.URL <> '');
  TasksP.CaptionBar.Caption:= 'Tasks ('
     + IntToStr(WorkOrderTasks.RowNo)
     + ' of '
     + IntToStr(WorkOrderTasks.RowCount) + ')';
end;



Resolution Resolution
Fixed Problem on 10/13/2015 in version 2.02 build 2


Products Affected Products Affected
Elevate Web Builder
Elevate Web Builder Trial

Image