Created
March 25, 2018 20:47
-
-
Save Pasquina/12a28f03765a856e4bbc2c6aa89dd369 to your computer and use it in GitHub Desktop.
LiveBindings Demo AfterScroll Event Handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ When the Branch list changes, either because of a scroll, or add or delete, this routine adjusts the | |
Employee list to display the appropriate employees } | |
procedure TMDLBO.AfterBranchScroll(ABindSourceAdapter: TBindSourceAdapter); | |
var | |
LBranch: TBranch; // currently displayed Branch | |
begin | |
{ A series of casts extracts the current TBranch object being displayed } | |
LBranch := TBranch(TListBindSourceAdapter(ABindSourceAdapter).Current); // obtain the current TBranch object | |
if Assigned(LBranch) then // might be an empty list if all entries have been deleted | |
begin | |
EmployeeWrapper.SetList( // change the Employee Wrapper to point to | |
LBranch.BranchEmployees, // the TObjectList<TEmployee> in the currently | |
False); // displayed Branch | |
EmployeeWrapper.First; // position to the first Employee | |
EmployeeWrapper.Active := True; // this will populate the list and make it visible | |
end | |
else | |
begin | |
EmployeeWrapper.SetList( // If there is no current branch | |
nil, // there can be no current employees | |
False); | |
end; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shows the event handler code needed to update the child ListView display when the focus of the parent ListView changes ListItems.