lcl: checkbox and radiobutton have ParentColor is true by default (bug #8284)

git-svn-id: trunk@10614 -
This commit is contained in:
vincents 2007-02-08 22:43:23 +00:00
parent 0d29519e8d
commit ff7a9a5c84
11 changed files with 215 additions and 4 deletions

6
.gitattributes vendored
View File

@ -2860,6 +2860,12 @@ test/bugs/7462/expected.txt svneol=native#text/plain
test/bugs/7462/unit1.lfm svneol=native#text/plain
test/bugs/7462/unit1.lrs svneol=native#text/plain
test/bugs/7462/unit1.pas svneol=native#text/plain
test/bugs/8284/bug8284.lpi svneol=native#text/plain
test/bugs/8284/bug8284.lpr svneol=native#text/plain
test/bugs/8284/expected.txt svneol=native#text/plain
test/bugs/8284/unit1.lfm svneol=native#text/plain
test/bugs/8284/unit1.lrs svneol=native#text/plain
test/bugs/8284/unit1.pas svneol=native#text/plain
test/bugtestcase.pas svneol=native#text/plain
test/hello.ahk svneol=native#text/plain
test/readme.txt svneol=native#text/plain

View File

@ -85,6 +85,7 @@ type
function DialogChar(var Message: TLMKey): boolean; override;
function ChildClassAllowed(ChildClass: TClass): boolean; override;
function IsBorderSpacingInnerBorderStored: Boolean; override;
property ParentColor default false;
public
constructor Create(TheOwner: TComponent); override;
procedure ExecuteDefaultAction; override;
@ -96,6 +97,7 @@ type
property Default: Boolean read FDefault write SetDefault default false;
property ModalResult: TModalResult read FModalResult write SetModalResult default mrNone;
property Cancel: Boolean read FCancel write SetCancel default false;
property Color default clBtnFace;
property TabStop default true;
end;

View File

@ -69,8 +69,6 @@ begin
inherited Create(TheOwner);
FUseOnChange:=DefaultButtonControlUseOnChange;
ControlStyle:=ControlStyle-csMultiClicks-[csAcceptsControls];
Color:=clBtnFace;
ParentColor:=false;
end;
{ TButtonActionLink }

View File

@ -27,6 +27,8 @@ begin
// set the component style to csButton
fCompStyle := csButton;
ControlStyle:=ControlStyle-[csClickEvents]+[csHasDefaultAction,csHasCancelAction];
Color:=clBtnFace;
ParentColor:=false;
TabStop := true;
// set default alignment
Align := alNone;

View File

@ -906,10 +906,8 @@ type
property Checked: Boolean read GetChecked write SetChecked stored IsCheckedStored default False;
property ClicksDisabled: Boolean read FClicksDisabled write FClicksDisabled;
property UseOnChange: boolean read FUseOnChange write FUseOnChange stored UseOnChangeIsStored;
property ParentColor default false;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
public
property Color default clBtnFace;
constructor Create(TheOwner: TComponent); override;
end;

View File

@ -0,0 +1,71 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="5"/>
<General>
<SessionStorage Value="InIDEConfig"/>
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="3">
<Unit0>
<Filename Value="bug8284.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="bug8284"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<ComponentName Value="Form1"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="unit1.lrs"/>
<UnitName Value="Unit1"/>
</Unit1>
<Unit2>
<Filename Value="expected.txt"/>
<IsPartOfProject Value="True"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
<Optimizations>
<OptimizationLevel Value="2"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<UseLineInfoUnit Value="False"/>
<UseHeaptrc Value="True"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@ -0,0 +1,18 @@
program bug8284;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms
{ add your units here }, Unit1;
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,3 @@
Button color: clBtnFace
Checkbox color: clLime
RadioButton color: clLime

46
test/bugs/8284/unit1.lfm Normal file
View File

@ -0,0 +1,46 @@
object Form1: TForm1
Left = 290
Height = 69
Top = 175
Width = 400
HorzScrollBar.Page = 399
VertScrollBar.Page = 68
Caption = 'Form1'
Color = clLime
object Button1: TButton
Left = 27
Height = 25
Top = 15
Width = 75
BorderSpacing.InnerBorder = 4
Caption = 'Button1'
TabOrder = 0
end
object CheckBox1: TCheckBox
Left = 130
Height = 13
Top = 18
Width = 75
Caption = 'CheckBox1'
TabOrder = 1
end
object RadioButton1: TRadioButton
Left = 256
Height = 13
Top = 18
Width = 85
Caption = 'RadioButton1'
TabOrder = 2
end
object ApplicationProperties1: TApplicationProperties
CaptureExceptions = True
HintColor = clInfoBk
HintHidePause = 2500
HintPause = 500
HintShortCuts = True
ShowHint = True
OnIdle = ApplicationProperties1Idle
left = 359
top = 16
end
end

16
test/bugs/8284/unit1.lrs Normal file
View File

@ -0,0 +1,16 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'"'#1#6'Height'#2'E'#3'Top'#3#175#0#5'Widt'
+'h'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertScrollBar.Page'#2'D'#7'Cap'
+'tion'#6#5'Form1'#5'Color'#7#6'clLime'#0#7'TButton'#7'Button1'#4'Left'#2#27#6
+'Height'#2#25#3'Top'#2#15#5'Width'#2'K'#25'BorderSpacing.InnerBorder'#2#4#7
+'Caption'#6#7'Button1'#8'TabOrder'#2#0#0#0#9'TCheckBox'#9'CheckBox1'#4'Left'
+#3#130#0#6'Height'#2#13#3'Top'#2#18#5'Width'#2'K'#7'Caption'#6#9'CheckBox1'#8
+'TabOrder'#2#1#0#0#12'TRadioButton'#12'RadioButton1'#4'Left'#3#0#1#6'Height'
+#2#13#3'Top'#2#18#5'Width'#2'U'#7'Caption'#6#12'RadioButton1'#8'TabOrder'#2#2
+#0#0#22'TApplicationProperties'#22'ApplicationProperties1'#17'CaptureExcepti'
+'ons'#9#9'HintColor'#7#8'clInfoBk'#13'HintHidePause'#3#196#9#9'HintPause'#3
+#244#1#13'HintShortCuts'#9#8'ShowHint'#9#6'OnIdle'#7#26'ApplicationPropertie'
+'s1Idle'#4'left'#3'g'#1#3'top'#2#16#0#0#0
]);

51
test/bugs/8284/unit1.pas Normal file
View File

@ -0,0 +1,51 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
ApplicationProperties1: TApplicationProperties;
Button1: TButton;
CheckBox1: TCheckBox;
RadioButton1: TRadioButton;
procedure ApplicationProperties1Idle(Sender: TObject; var Done: Boolean);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.ApplicationProperties1Idle(Sender: TObject; var Done: Boolean);
begin
if ParamStr(1)='--runtest' then begin
// button doesn't have parentcolor, but is buttonface
writeln('Button color: ', ColorToString(Button1.Color));
// checkbox takes parent color
writeln('Checkbox color: ', ColorToString(CheckBox1.Color));
// radiobutton takes parent color
writeln('RadioButton color: ', ColorToString(RadioButton1.Color));
Close;
end;
end;
initialization
{$I unit1.lrs}
end.