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_Fraction = 'Fraction';
|
||||
rsNumberFormatCaption_Currency = 'Currency';
|
||||
rsNumberFormatCaption_CurrencyRed = 'Currency (red)';
|
||||
rsNumberFormatCaption_CurrencyRed = 'Currency';
|
||||
rsNumberFormatCaption_ShortDateTime = 'Date and time';
|
||||
rsNumberFormatCaption_ShortDate = 'Short date';
|
||||
rsNumberFormatCaption_LongDate = 'Long date';
|
||||
|
@ -274,16 +274,18 @@ type
|
||||
FNumberFormatStr: string;
|
||||
FOnGetNumFormatStr: TsNumFormatStrEvent;
|
||||
procedure SetNumberFormat(AValue: TsNumberFormat);
|
||||
procedure SetNumberFormatStr(AValue: String);
|
||||
protected
|
||||
procedure ApplyFormatToCell(ACell: PCell); override;
|
||||
procedure ExtractFromCell(ACell: PCell); override;
|
||||
procedure UpdateCaptionAndHint;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
published
|
||||
property NumberFormat: TsNumberFormat
|
||||
read FNumberFormat write SetNumberFormat default nfGeneral;
|
||||
property NumberFormatString: string
|
||||
read FNumberFormatStr write FNumberFormatStr;
|
||||
read FNumberFormatStr write SetNumberFormatStr;
|
||||
property OnGetNumberFormatString: TsNumFormatStrEvent
|
||||
read FOnGetNumFormatStr write FOnGetNumFormatStr;
|
||||
end;
|
||||
@ -1212,7 +1214,7 @@ begin
|
||||
inherited Create(AOwner);
|
||||
Caption := rsNumberFormatCaption_General;
|
||||
Hint := rsNumberFormatHint_General;
|
||||
GroupIndex := 1411141258; // Date/time when this was written
|
||||
GroupIndex := 1411141258; // Date/time when this code was written
|
||||
AutoCheck := true;
|
||||
end;
|
||||
|
||||
@ -1255,16 +1257,32 @@ begin
|
||||
end;
|
||||
|
||||
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);
|
||||
begin
|
||||
Caption := ACaption;
|
||||
Hint := AHint;
|
||||
if Caption = '' then begin
|
||||
if FNumberFormatStr <> '' then
|
||||
Caption := Format('%s (%s)', [ACaption, FNumberFormatStr])
|
||||
else
|
||||
Caption := ACaption;
|
||||
end;
|
||||
if Hint = '' then
|
||||
Hint := AHint;
|
||||
end;
|
||||
|
||||
begin
|
||||
if AValue = FNumberFormat then exit;
|
||||
FNumberFormat := AValue;
|
||||
case FNumberFormat of
|
||||
nfGeneral:
|
||||
CaptionAndHint(rsNumberFormatCaption_General, rsNumberFormatHint_General);
|
||||
|
Reference in New Issue
Block a user