carbon: fix for #14759

git-svn-id: trunk@23725 -
This commit is contained in:
dmitry 2010-02-17 09:10:03 +00:00
parent 11f880e78a
commit 9ae2f80938
2 changed files with 14 additions and 7 deletions

View File

@ -183,7 +183,8 @@ var
n: Integer;
begin
nm := PNMListView(AMessage.NMHdr);
if nm^.iItem>=Items.Count then exit;
// ignore any notifications while initializing items
if (nm^.iItem>=Items.Count) or not (lisfWSItemsCreated in FListItems.Flags) then exit;
//remark: NMHdr^.code is normally unhanged by the win32 interface, so the others
// maps there codes to the of win32
case AMessage.NMHdr^.code of
@ -230,7 +231,6 @@ 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

View File

@ -916,14 +916,17 @@ begin
end;
procedure TCarbonDataBrowser.UpdateItems;
var
i : Integer;
begin
// removes all and adds new count of items starting with index 1
{// removes all and adds new count of items starting with index 1
OSError(RemoveDataBrowserItems(Widget, kDataBrowserNoItem, 0, nil, kDataBrowserItemNoProperty),
Self, 'UpdateItems', 'RemoveDataBrowserItems');
if GetItemsCount <> 0 then
OSError(AddDataBrowserItems(Widget, kDataBrowserNoItem, GetItemsCount, nil, kDataBrowserItemNoProperty),
Self, 'UpdateItems', 'AddDataBrowserItems');
Self, 'UpdateItems', 'AddDataBrowserItems');}
for i:=0 to GetItemsCount-1 do UpdateItem(i);
CheckNeedsScrollBars;
end;
@ -1467,10 +1470,15 @@ begin
end;
procedure TCarbonDataBrowser.InsertItem(AIndex: Integer);
var
Item : DataBrowserItemID;
i : Integer;
begin
Item := GetItemsCount+1;
FItemsCheck.Insert(AIndex, Pointer(False));
UpdateItems;
OSError( AddDataBrowserItems(Widget, kDataBrowserNoItem, 1, @Item, kDataBrowserItemNoProperty),
Self, 'InsertItem', 'AddDataBrowserItems');
for i := AIndex to GetItemsCount-1 do UpdateItem(i);
end;
procedure TCarbonDataBrowser.UpdateItem(AIndex: Integer);
@ -1478,7 +1486,6 @@ var
Item: DataBrowserItemID;
begin
Item := AIndex + 1;
OSError(UpdateDataBrowserItems(Widget, kDataBrowserNoItem, 1, @Item,
kDataBrowserItemNoProperty, kDataBrowserNoItem),
Self, 'UpdateItem', 'UpdateDataBrowserItems');