mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-19 22:29:37 +01:00
LCL carbon: fixed clearing TListBox, added check when accessing TListBox.Items
git-svn-id: trunk@13831 -
This commit is contained in:
parent
79b247b5dd
commit
7e4fdbb9ab
@ -764,7 +764,8 @@ begin
|
||||
CheckNeedsScrollBars;
|
||||
|
||||
// removes all and adds new count of items starting with index 1
|
||||
ClearItems;
|
||||
OSError(RemoveDataBrowserItems(Widget, kDataBrowserNoItem, 0, nil, kDataBrowserItemNoProperty),
|
||||
Self, 'UpdateItems', 'RemoveDataBrowserItems');
|
||||
|
||||
if GetItemsCount <> 0 then
|
||||
OSError(AddDataBrowserItems(Widget, kDataBrowserNoItem, GetItemsCount, nil, kDataBrowserItemNoProperty),
|
||||
@ -773,6 +774,8 @@ end;
|
||||
|
||||
procedure TCarbonDataBrowser.ClearItems;
|
||||
begin
|
||||
FItemsCheck.Clear;
|
||||
|
||||
OSError(RemoveDataBrowserItems(Widget, kDataBrowserNoItem, 0, nil, kDataBrowserItemNoProperty),
|
||||
Self, 'ClearItems', 'RemoveDataBrowserItems');
|
||||
end;
|
||||
@ -1322,7 +1325,10 @@ end;
|
||||
|
||||
function TCarbonListBox.GetItemCaption(AIndex, ASubIndex: Integer): String;
|
||||
begin
|
||||
Result := (LCLObject as TCustomListBox).Items[AIndex];
|
||||
if (AIndex >= 0) and (AIndex < (LCLObject as TCustomListBox).Items.Count) then
|
||||
Result := (LCLObject as TCustomListBox).Items[AIndex]
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
function TCarbonListBox.GetReadOnly: Boolean;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user