From 11f880e78a7a9ad20c7c2038783888771f850ea9 Mon Sep 17 00:00:00 2001 From: dmitry Date: Wed, 17 Feb 2010 06:51:12 +0000 Subject: [PATCH] lcl: setting items state on listview handle creation git-svn-id: trunk@23724 - --- lcl/comctrls.pp | 1 + lcl/include/customlistview.inc | 1 + lcl/include/listitem.inc | 12 ++++++++++++ lcl/include/listitems.inc | 2 ++ 4 files changed, 16 insertions(+) diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index d5ca2be25e..6ebcf0a644 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -720,6 +720,7 @@ type procedure WSUpdateText; procedure WSUpdateImages; procedure WSUpdateChecked; + procedure WSSetState; procedure WSUpdateState; procedure SetChecked(AValue: Boolean); diff --git a/lcl/include/customlistview.inc b/lcl/include/customlistview.inc index 45acdb92aa..8fb33c4cde 100644 --- a/lcl/include/customlistview.inc +++ b/lcl/include/customlistview.inc @@ -230,6 +230,7 @@ begin end; LVN_ITEMCHANGED: begin Item := Items[nm^.iItem]; + if not (lisfWSItemsCreated in FListItems.Flags) then Exit; //DebugLn('TCustomListView.CNNotify Count=',dbgs(Items.Count),' nm^.iItem=',dbgs(nm^.iItem),' destroying=',dbgs(lifDestroying in Item.FFlags)); if (Item <> nil) and (not OwnerData) and (lifDestroying in Item.FFlags) then begin if Item=FFocused then diff --git a/lcl/include/listitem.inc b/lcl/include/listitem.inc index 734279b235..10f6519348 100644 --- a/lcl/include/listitem.inc +++ b/lcl/include/listitem.inc @@ -458,6 +458,18 @@ begin end; end; +procedure TListItem.WSSetState; +var + AState: TListItemState; + LV: TCustomListView; + idx: Integer; +begin + LV := FOwner.FOwner; + idx := GetIndex; + for AState := Low(TListItemState) to High(TListItemState) do + TWSCustomListViewClass(LV.WidgetSetClass).ItemSetState(LV, idx, Self, AState, AState in FStates); +end; + {------------------------------------------------------------------------------} { TListItem IntfUpdateAllowed } {------------------------------------------------------------------------------} diff --git a/lcl/include/listitems.inc b/lcl/include/listitems.inc index 28c3901bf8..f70ef12744 100644 --- a/lcl/include/listitems.inc +++ b/lcl/include/listitems.inc @@ -185,6 +185,8 @@ begin FCacheItem.WSUpdateText; FCacheItem.WSUpdateImages; FCacheItem.WSUpdateChecked; + if not (lisfWSItemsCreated in FFlags) then + FCacheItem.WSSetState; FCacheItem.WSUpdateState; end;