MG: customradiogroup is now streamable

git-svn-id: trunk@226 -
This commit is contained in:
lazarus 2001-03-15 14:42:20 +00:00
parent 9522dc1fd6
commit d7a5998509
2 changed files with 52 additions and 23 deletions

View File

@ -280,8 +280,10 @@ type
FItems : TStrings; FItems : TStrings;
FItemIndex : integer; FItemIndex : integer;
FColumns : integer; FColumns : integer;
FReading : boolean;
procedure ItemsChanged (Sender : TObject); procedure ItemsChanged (Sender : TObject);
protected protected
procedure ReadState(Reader: TReader); override;
procedure SetItem (value : TStrings); procedure SetItem (value : TStrings);
procedure SetColumns (value : integer); procedure SetColumns (value : integer);
procedure SetItemIndex (value : integer); procedure SetItemIndex (value : integer);
@ -326,6 +328,9 @@ end.
{ {
$Log$ $Log$
Revision 1.8 2001/03/15 14:42:20 lazarus
MG: customradiogroup is now streamable
Revision 1.7 2001/01/12 18:27:31 lazarus Revision 1.7 2001/01/12 18:27:31 lazarus
Streaming additions by MAttias Streaming additions by MAttias
Shane Shane

View File

@ -187,8 +187,10 @@ end;
Select one of the radiobuttons Select one of the radiobuttons
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TCustomRadioGroup.SetItemIndex (value : integer); procedure TCustomRadioGroup.SetItemIndex (Value : integer);
begin begin
if FReading then FItemIndex:=Value
else begin
if (Value < -1) or (Value >= FItems.Count) if (Value < -1) or (Value >= FItems.Count)
then raise Exception.Create('TCustomRadioGroup: Out of bounds'); then raise Exception.Create('TCustomRadioGroup: Out of bounds');
@ -202,6 +204,7 @@ begin
end end
else FItemIndex := value; else FItemIndex := value;
end; end;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TCustomRadioGroup.SetItemIndex Method: TCustomRadioGroup.SetItemIndex
@ -218,7 +221,8 @@ begin
if (HandleAllocated) then if (HandleAllocated) then
begin begin
i := 0; i := 0;
// This nasty little loop is neccessary because the group is not informed when a button is pressed // This nasty little loop is neccessary because the group is not informed
// when a button is pressed
while (i < FButtonList.Count) and (result = -1) do while (i < FButtonList.Count) and (result = -1) do
begin // find the actice button begin // find the actice button
if TRadioButton (FButtonList [i]).Checked if TRadioButton (FButtonList [i]).Checked
@ -243,8 +247,28 @@ begin
result := true; result := true;
end; end;
{------------------------------------------------------------------------------
Method: TCustomRadioGroup.ReadState
Params: Reader: TReader
executed when component is read from stream
------------------------------------------------------------------------------}
procedure TCustomRadioGroup.ReadState(Reader: TReader);
begin
FReading := True;
inherited ReadState(Reader);
FReading := False;
if HandleAllocated then RecreateWnd;
end;
{ {
$Log$ $Log$
Revision 1.5 2001/03/15 14:42:20 lazarus
MG: customradiogroup is now streamable
Revision 1.4 2001/02/06 13:38:58 lazarus Revision 1.4 2001/02/06 13:38:58 lazarus
Fixes from Mattias for EditorOPtions Fixes from Mattias for EditorOPtions
Fixes to COmpiler that should allow people to compile if their path is set up. Fixes to COmpiler that should allow people to compile if their path is set up.