Win32,WinCE,Carbon: fixed saving checkbox state inside TCheckListBox when moving items. issue #20589

git-svn-id: trunk@33172 -
This commit is contained in:
zeljko 2011-10-30 12:21:35 +00:00
parent b2cfc29c58
commit bec12a3edc
5 changed files with 36 additions and 1 deletions

View File

@ -67,6 +67,7 @@ type
constructor Create(AOwner: TCarbonListBox);
procedure Clear; override;
procedure Delete(Index: Integer); override;
procedure Move(CurIndex, NewIndex: Integer); override;
procedure Sort; override;
procedure Exchange(Index1, Index2: Integer); override;
public
@ -96,7 +97,7 @@ type
implementation
uses
CarbonProc;
CarbonProc, CarbonWSCheckLst, CheckLst;
{ TCarbonComboBoxStrings }
@ -288,6 +289,20 @@ begin
FOwner.DeleteItem(Index);
end;
procedure TCarbonListBoxStrings.Move(CurIndex, NewIndex: Integer);
var
AState: TCheckBoxState;
begin
if Owner is TCustomCheckListBox then
AState := TCarbonWSCustomCheckListBox.GetState(TCustomCheckListBox(Owner), CurIndex);
inherited Move(CurIndex, NewIndex);
if Owner is TCustomCheckListBox then
TCarbonWSCustomCheckListBox.SetState(TCustomCheckListBox(Owner), NewIndex, AState);
end;
{------------------------------------------------------------------------------
Method: TCarbonListBoxStrings.Sort

View File

@ -548,6 +548,15 @@ begin
inherited Delete(Index);
end;
procedure TWin32CheckListBoxStrings.Move(CurIndex, NewIndex: Integer);
var
AState: TCheckBoxState;
begin
AState := State[CurIndex];
inherited Move(CurIndex, NewIndex);
State[NewIndex] := AState;
end;
function TWin32CheckListBoxStrings.GetObject(Index: Integer): TObject;
begin
Result:= GetItemRecord(Index, false)^.TheObject;

View File

@ -128,6 +128,7 @@ Type
class procedure DeleteItemRecord(const List: HWND; const Index: integer);
procedure Clear; override;
procedure Delete(Index: Integer); override;
procedure Move(CurIndex, NewIndex: Integer); override;
property Enabled[Index: Integer]: Boolean read GetEnabled write SetEnabled;
property State[Index: Integer]: TCheckBoxState read GetState write SetState;
end;

View File

@ -454,6 +454,15 @@ begin
inherited Delete(Index);
end;
procedure TWinCECheckListBoxStrings.Move(CurIndex, NewIndex: Integer);
var
AState: TCheckBoxState;
begin
AState := State[CurIndex];
inherited Move(CurIndex, NewIndex);
State[NewIndex] := AState;
end;
function TWinCECheckListBoxStrings.GetObject(Index: Integer): TObject;
begin
Result:= GetItemRecord(Index, false)^.TheObject;

View File

@ -113,6 +113,7 @@ type
class procedure DeleteItemRecord(const List: HWND; const Index: integer);
procedure Clear; override;
procedure Delete(Index: Integer); override;
procedure Move(CurIndex, NewIndex: Integer); override;
property State[AIndex: Integer]: TCheckBoxState read GetState write SetState;
end;