You've already forked lazarus-ccr
fpspreadsheet: Fix captions and hints of spreadsheet actions not being changeable.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6565 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -266,7 +266,7 @@ const
|
|||||||
rsNumberFormatCaption_Percentage = 'Percent';
|
rsNumberFormatCaption_Percentage = 'Percent';
|
||||||
rsNumberFormatCaption_Fraction = 'Fraction';
|
rsNumberFormatCaption_Fraction = 'Fraction';
|
||||||
rsNumberFormatCaption_Currency = 'Currency';
|
rsNumberFormatCaption_Currency = 'Currency';
|
||||||
rsNumberFormatCaption_CurrencyRed = 'Currency (red)';
|
rsNumberFormatCaption_CurrencyRed = 'Currency';
|
||||||
rsNumberFormatCaption_ShortDateTime = 'Date and time';
|
rsNumberFormatCaption_ShortDateTime = 'Date and time';
|
||||||
rsNumberFormatCaption_ShortDate = 'Short date';
|
rsNumberFormatCaption_ShortDate = 'Short date';
|
||||||
rsNumberFormatCaption_LongDate = 'Long date';
|
rsNumberFormatCaption_LongDate = 'Long date';
|
||||||
|
@ -274,16 +274,18 @@ type
|
|||||||
FNumberFormatStr: string;
|
FNumberFormatStr: string;
|
||||||
FOnGetNumFormatStr: TsNumFormatStrEvent;
|
FOnGetNumFormatStr: TsNumFormatStrEvent;
|
||||||
procedure SetNumberFormat(AValue: TsNumberFormat);
|
procedure SetNumberFormat(AValue: TsNumberFormat);
|
||||||
|
procedure SetNumberFormatStr(AValue: String);
|
||||||
protected
|
protected
|
||||||
procedure ApplyFormatToCell(ACell: PCell); override;
|
procedure ApplyFormatToCell(ACell: PCell); override;
|
||||||
procedure ExtractFromCell(ACell: PCell); override;
|
procedure ExtractFromCell(ACell: PCell); override;
|
||||||
|
procedure UpdateCaptionAndHint;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
published
|
published
|
||||||
property NumberFormat: TsNumberFormat
|
property NumberFormat: TsNumberFormat
|
||||||
read FNumberFormat write SetNumberFormat default nfGeneral;
|
read FNumberFormat write SetNumberFormat default nfGeneral;
|
||||||
property NumberFormatString: string
|
property NumberFormatString: string
|
||||||
read FNumberFormatStr write FNumberFormatStr;
|
read FNumberFormatStr write SetNumberFormatStr;
|
||||||
property OnGetNumberFormatString: TsNumFormatStrEvent
|
property OnGetNumberFormatString: TsNumFormatStrEvent
|
||||||
read FOnGetNumFormatStr write FOnGetNumFormatStr;
|
read FOnGetNumFormatStr write FOnGetNumFormatStr;
|
||||||
end;
|
end;
|
||||||
@ -1212,7 +1214,7 @@ begin
|
|||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
Caption := rsNumberFormatCaption_General;
|
Caption := rsNumberFormatCaption_General;
|
||||||
Hint := rsNumberFormatHint_General;
|
Hint := rsNumberFormatHint_General;
|
||||||
GroupIndex := 1411141258; // Date/time when this was written
|
GroupIndex := 1411141258; // Date/time when this code was written
|
||||||
AutoCheck := true;
|
AutoCheck := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1255,16 +1257,32 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsNumberFormatAction.SetNumberFormat(AValue: TsNumberFormat);
|
procedure TsNumberFormatAction.SetNumberFormat(AValue: TsNumberFormat);
|
||||||
|
begin
|
||||||
|
FNumberFormat := AValue;
|
||||||
|
UpdateCaptionAndHint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsNumberFormatAction.SetNumberFormatStr(AValue: String);
|
||||||
|
begin
|
||||||
|
FNumberFormatStr := AValue;
|
||||||
|
UpdateCaptionAndHint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsNumberFormatAction.UpdateCaptionAndHint;
|
||||||
|
|
||||||
procedure CaptionAndHint(ACaption, AHint: String);
|
procedure CaptionAndHint(ACaption, AHint: String);
|
||||||
begin
|
begin
|
||||||
Caption := ACaption;
|
if Caption = '' then begin
|
||||||
Hint := AHint;
|
if FNumberFormatStr <> '' then
|
||||||
|
Caption := Format('%s (%s)', [ACaption, FNumberFormatStr])
|
||||||
|
else
|
||||||
|
Caption := ACaption;
|
||||||
|
end;
|
||||||
|
if Hint = '' then
|
||||||
|
Hint := AHint;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if AValue = FNumberFormat then exit;
|
|
||||||
FNumberFormat := AValue;
|
|
||||||
case FNumberFormat of
|
case FNumberFormat of
|
||||||
nfGeneral:
|
nfGeneral:
|
||||||
CaptionAndHint(rsNumberFormatCaption_General, rsNumberFormatHint_General);
|
CaptionAndHint(rsNumberFormatCaption_General, rsNumberFormatHint_General);
|
||||||
|
Reference in New Issue
Block a user