diff --git a/components/fpspreadsheet/examples/visual/fpsctrls/demo_ctrls.lpi b/components/fpspreadsheet/examples/visual/fpsctrls/demo_ctrls.lpi index 95a0b9ae3..60279b956 100644 --- a/components/fpspreadsheet/examples/visual/fpsctrls/demo_ctrls.lpi +++ b/components/fpspreadsheet/examples/visual/fpsctrls/demo_ctrls.lpi @@ -9,6 +9,7 @@ <ResourceType Value="res"/> <UseXPManifest Value="True"/> + <Icon Value="0"/> </General> <i18n> <EnableI18N LFM="False"/> @@ -24,6 +25,7 @@ <PathDelim Value="\"/> <SearchPaths> <IncludeFiles Value="$(ProjOutDir)"/> + <OtherUnitFiles Value="..\shared"/> </SearchPaths> <CodeGeneration> <SmartLinkUnit Value="True"/> @@ -58,7 +60,7 @@ <PackageName Value="LCL"/> </Item2> </RequiredPackages> - <Units Count="2"> + <Units Count="6"> <Unit0> <Filename Value="demo_ctrls.lpr"/> <IsPartOfProject Value="True"/> @@ -71,6 +73,29 @@ <ResourceBaseClass Value="Form"/> <UnitName Value="main"/> </Unit1> + <Unit2> + <Filename Value="..\shared\scsvparamsform.pas"/> + <IsPartOfProject Value="True"/> + <HasResources Value="True"/> + <UnitName Value="sCSVParamsForm"/> + </Unit2> + <Unit3> + <Filename Value="..\shared\sformatsettingsform.pas"/> + <IsPartOfProject Value="True"/> + <HasResources Value="True"/> + </Unit3> + <Unit4> + <Filename Value="..\shared\ssortparamsform.pas"/> + <IsPartOfProject Value="True"/> + <HasResources Value="True"/> + </Unit4> + <Unit5> + <Filename Value="..\shared\scurrencyform.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="CurrencyForm"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="scurrencyform"/> + </Unit5> </Units> </ProjectOptions> <CompilerOptions> @@ -81,6 +106,7 @@ </Target> <SearchPaths> <IncludeFiles Value="$(ProjOutDir)"/> + <OtherUnitFiles Value="..\shared"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> </SearchPaths> <CodeGeneration> diff --git a/components/fpspreadsheet/examples/visual/fpsctrls/demo_ctrls.lpr b/components/fpspreadsheet/examples/visual/fpsctrls/demo_ctrls.lpr index 955483b58..7a56e805e 100644 --- a/components/fpspreadsheet/examples/visual/fpsctrls/demo_ctrls.lpr +++ b/components/fpspreadsheet/examples/visual/fpsctrls/demo_ctrls.lpr @@ -7,7 +7,8 @@ uses cthreads, {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset - Forms, main + Forms, main, scsvparamsform, sformatsettingsform, + ssortparamsform, scurrencyform { you can add units after this }; {$R *.res} diff --git a/components/fpspreadsheet/examples/visual/fpsctrls/main.lfm b/components/fpspreadsheet/examples/visual/fpsctrls/main.lfm index 20e0ffb8e..e3784e40e 100644 --- a/components/fpspreadsheet/examples/visual/fpsctrls/main.lfm +++ b/components/fpspreadsheet/examples/visual/fpsctrls/main.lfm @@ -55,7 +55,7 @@ object MainForm: TMainForm Top = 83 Width = 253 OnChange = InspectorTabControlChange - TabIndex = 1 + TabIndex = 0 Tabs.Strings = ( 'Workbook' 'Worksheet' @@ -71,7 +71,7 @@ object MainForm: TMainForm Top = 23 Width = 249 Align = alClient - RowCount = 32 + RowCount = 30 TabOrder = 1 TitleStyle = tsNative DisplayOptions = [doColumnTitles] @@ -101,13 +101,11 @@ object MainForm: TMainForm ' PosCurrencyFormat=3' ' NegCurrencyFormat=8' ' TwoDigitYearCenturyWindow=50' - 'Font0=Arial; size 10,0; color black' - 'Font1=Arial; size 10,0; color black; bold' - 'Font2=Arial; size 10,0; color black; italic' - 'Font3=Arial; size 10,0; color black; underline' - 'Font4=' - 'Font5=Arial; size 10,0; color black; bold; italic' - 'Font6=Arial; size 10,0; color blue; underline' + 'Font0=Arial; size 10; black' + 'Font1=Arial; size 10; blue; underline' + 'Font2=Arial; size 10; black; bold' + 'Font3=Arial; size 10; black; italic' + 'CellFormat0=' ) TitleCaptions.Strings = ( 'Properties' @@ -1437,6 +1435,24 @@ object MainForm: TMainForm Hint = 'Delete comment' ImageIndex = 55 end + object AcSettingsCSVParams: TAction + Category = 'Settings' + Caption = 'CSV parameters...' + Hint = 'Parameters for CSV files' + OnExecute = AcSettingsCSVParamsExecute + end + object AcSettingsCurrency: TAction + Category = 'Settings' + Caption = 'Currency symbols...' + Hint = 'Define currency symbols' + OnExecute = AcSettingsCurrencyExecute + end + object AcSettingsFormatSettings: TAction + Category = 'Settings' + Caption = 'Number format settings...' + Hint = 'Define number format settings' + OnExecute = AcSettingsFormatSettingsExecute + end end object ImageList: TImageList left = 176 @@ -4781,6 +4797,18 @@ object MainForm: TMainForm AutoCheck = True end end + object MnuSettings: TMenuItem + Caption = 'Settings' + object MenuItem109: TMenuItem + Action = AcSettingsFormatSettings + end + object MenuItem107: TMenuItem + Action = AcSettingsCSVParams + end + object MenuItem108: TMenuItem + Action = AcSettingsCurrency + end + end end object PuNumFormat: TPopupMenu left = 504 diff --git a/components/fpspreadsheet/examples/visual/fpsctrls/main.pas b/components/fpspreadsheet/examples/visual/fpsctrls/main.pas index 9567eca55..a105432dd 100644 --- a/components/fpspreadsheet/examples/visual/fpsctrls/main.pas +++ b/components/fpspreadsheet/examples/visual/fpsctrls/main.pas @@ -18,6 +18,9 @@ type AcColDelete: TAction; AcRowAdd: TAction; AcColAdd: TAction; + AcSettingsCSVParams: TAction; + AcSettingsCurrency: TAction; + AcSettingsFormatSettings: TAction; AcViewInspector: TAction; ActionList: TActionList; AcFileExit: TFileExit; @@ -34,6 +37,10 @@ type MenuItem104: TMenuItem; MenuItem105: TMenuItem; MenuItem106: TMenuItem; + MenuItem107: TMenuItem; + MenuItem108: TMenuItem; + MenuItem109: TMenuItem; + MnuSettings: TMenuItem; MenuItem11: TMenuItem; MenuItem12: TMenuItem; MenuItem13: TMenuItem; @@ -290,6 +297,9 @@ type procedure AcFileSaveAsAccept(Sender: TObject); procedure AcRowAddExecute(Sender: TObject); procedure AcRowDeleteExecute(Sender: TObject); + procedure AcSettingsCSVParamsExecute(Sender: TObject); + procedure AcSettingsCurrencyExecute(Sender: TObject); + procedure AcSettingsFormatSettingsExecute(Sender: TObject); procedure AcViewInspectorExecute(Sender: TObject); procedure InspectorTabControlChange(Sender: TObject); procedure ToolButton4Click(Sender: TObject); @@ -310,7 +320,8 @@ implementation {$R *.lfm} uses - fpsUtils; + fpsUtils, fpsCSV, + sCSVParamsForm, sCurrencyForm, sFormatSettingsForm, sSortParamsForm; { TMainForm } @@ -390,6 +401,53 @@ begin WorksheetGrid.Row := r; end; +procedure TMainForm.AcSettingsCSVParamsExecute(Sender: TObject); +var + F: TCSVParamsForm; +begin + F := TCSVParamsForm.Create(nil); + try + F.SetParams(fpscsv.CSVParams); + if F.ShowModal = mrOK then + F.GetParams(fpscsv.CSVParams); + finally + F.Free; + end; +end; + +procedure TMainForm.AcSettingsCurrencyExecute(Sender: TObject); +var + F: TCurrencyForm; +begin + F := TCurrencyForm.Create(nil); + try + F.ShowModal; + finally + F.Free; + end; +end; + +procedure TMainForm.AcSettingsFormatSettingsExecute(Sender: TObject); +var + F: TFormatSettingsForm; +begin + if WorksheetGrid.Workbook = nil then + exit; + + F := TFormatSettingsForm.Create(nil); + try + F.FormatSettings := WorksheetGrid.Workbook.FormatSettings; + if F.ShowModal = mrOK then + begin + WorksheetGrid.Workbook.FormatSettings := F.FormatSettings; + WorksheetGrid.Invalidate; + end; + finally + F.Free; + end; +end; + + { Toggles the spreadsheet inspector on and off } procedure TMainForm.AcViewInspectorExecute(Sender: TObject); begin diff --git a/components/fpspreadsheet/examples/visual/shared/scsvparamsform.lfm b/components/fpspreadsheet/examples/visual/shared/scsvparamsform.lfm index 5ea4ea85d..78a484a1c 100644 --- a/components/fpspreadsheet/examples/visual/shared/scsvparamsform.lfm +++ b/components/fpspreadsheet/examples/visual/shared/scsvparamsform.lfm @@ -10,7 +10,7 @@ object CSVParamsForm: TCSVParamsForm OnCloseQuery = FormCloseQuery OnCreate = FormCreate Position = poMainFormCenter - LCLVersion = '1.3' + LCLVersion = '1.5' object ButtonPanel: TButtonPanel Left = 6 Height = 34 @@ -522,14 +522,14 @@ object CSVParamsForm: TCSVParamsForm object EdTRUE: TEdit Left = 16 Height = 23 - Top = 45 + Top = 40 Width = 131 TabOrder = 0 end object EdFALSE: TEdit Left = 176 Height = 23 - Top = 45 + Top = 40 Width = 131 TabOrder = 1 end diff --git a/components/fpspreadsheet/examples/visual/spready/sctrls.pas b/components/fpspreadsheet/examples/visual/shared/sctrls.pas similarity index 100% rename from components/fpspreadsheet/examples/visual/spready/sctrls.pas rename to components/fpspreadsheet/examples/visual/shared/sctrls.pas diff --git a/components/fpspreadsheet/examples/visual/shared/scurrencyform.lfm b/components/fpspreadsheet/examples/visual/shared/scurrencyform.lfm new file mode 100644 index 000000000..60bcdde08 --- /dev/null +++ b/components/fpspreadsheet/examples/visual/shared/scurrencyform.lfm @@ -0,0 +1,173 @@ +object CurrencyForm: TCurrencyForm + Left = 544 + Height = 288 + Top = 339 + Width = 245 + BorderStyle = bsDialog + Caption = 'Currency symbols' + ClientHeight = 288 + ClientWidth = 245 + OnCreate = FormCreate + ShowHint = True + LCLVersion = '1.5' + object LblInfo: TLabel + Left = 4 + Height = 15 + Top = 4 + Width = 237 + Align = alTop + BorderSpacing.Around = 4 + Caption = 'These strings indicate currencies:' + ParentColor = False + WordWrap = True + end + object CurrencyListbox: TListBox + Left = 4 + Height = 223 + Top = 23 + Width = 237 + Align = alClient + BorderSpacing.Around = 4 + ItemHeight = 0 + TabOrder = 0 + end + object ButtonPanel: TPanel + Left = 0 + Height = 38 + Top = 250 + Width = 245 + Align = alBottom + ClientHeight = 38 + ClientWidth = 245 + FullRepaint = False + TabOrder = 1 + object BtnOK: TBitBtn + Left = 77 + Height = 25 + Hint = 'Accept changes and close' + Top = 8 + Width = 75 + Anchors = [akTop, akRight] + DefaultCaption = True + Kind = bkOK + ModalResult = 1 + OnClick = BtnOKClick + TabOrder = 0 + end + object BtnCancel: TBitBtn + Left = 157 + Height = 25 + Hint = 'Discard changes and close' + Top = 8 + Width = 83 + Anchors = [akTop, akRight] + DefaultCaption = True + Kind = bkCancel + ModalResult = 2 + TabOrder = 1 + end + object ButtonBevel: TBevel + Left = 5 + Height = 3 + Top = 1 + Width = 235 + Align = alTop + BorderSpacing.Left = 4 + BorderSpacing.Right = 4 + Shape = bsTopLine + end + object BtnAdd: TBitBtn + Left = 8 + Height = 25 + Hint = 'Add a currency symbol' + Top = 8 + Width = 27 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0041924E233D8F497D3A8C44DB368940F332873CF32F84 + 37DB2C81337D287F3023FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0049995853459653E6419950FF7DC28FFF96D0A6FF96CFA6FF78BE + 89FF368D42FF2C8134E6297F3053FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00519F61534D9C5DF464B478FFA8DBB5FF87CC98FF66BC7DFF64BA7CFF86CB + 98FFA5D9B4FF58AA6BFF2C8134F4297F3053FFFFFF00FFFFFF00FFFFFF0059A6 + 6B2256A366E56AB97DFFA8DBB2FF60BC77FF5CBA73FF59B870FF59B56FFF58B5 + 6FFF5BB774FFA5D9B3FF5AAA6CFF2C8234E5297F3022FFFFFF00FFFFFF005DA9 + 707E53AB68FFAADDB4FF64C179FF5FBE71FF60BC77FFFFFFFFFFFFFFFFFF59B8 + 70FF58B56EFF5CB774FFA6DAB4FF388F43FF2C82347EFFFFFF00FFFFFF0061AC + 75DB8ACC98FF89D396FF6BC67AFF63C170FF55AB65FFFFFFFFFFFFFFFFFF59B8 + 70FF59B870FF5BB972FF85CC97FF7BBE8DFF308539DBFFFFFF00FFFFFF0065AF + 7AF6A9DDB3FF7DCF8AFF75CC81FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF59B870FF67BE7DFF9CD4ABFF34883DF6FFFFFF00FFFFFF0069B2 + 7EF6B6E2BEFF8BD597FF7AC986FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF59B870FF69C17EFF9DD4AAFF388B42F6FFFFFF00FFFFFF006DB5 + 83DBACDDB6FFA6DFAFFF81CB8CFF7CC986FF6EBD79FFFFFFFFFFFFFFFFFF5BAC + 6AFF60BC77FF5CBA73FF8BD199FF80C592FF3C8E47DBFFFFFF00FFFFFF0070B8 + 877E85C797FFD2EED7FF95D9A0FF8AD394FF7FC889FFFFFFFFFFFFFFFFFF79CD + 85FF6BC37CFF6FC77EFFACDFB5FF459E57FF40914C7EFFFFFF00FFFFFF0073BA + 8A2270B887E5AADAB7FFD8F1DCFF92D89DFF88CD93FF84CC8EFF8BD496FF8AD4 + 95FF83D28EFFAFE0B7FF6BB97DFF489856E544945122FFFFFF00FFFFFF00FFFF + FF0073BB8B5370B887F4AFDCBBFFDCF2E0FFB6E4BDFF9BDBA5FF96D9A0FFA5DF + AFFFC0E8C5FF79C28AFF509E5FF44C9B5B53FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0073BB8B5371B887E694CEA4FFC3E6CBFFCFEBD4FFC9E9CEFFAFDD + B8FF6DB97FFF58A569E654A16553FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF0074BB8B2371B9887D6EB684DB6AB380F367B17CF363AE + 77DB60AB737D5CA86E23FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + ModalResult = 6 + OnClick = BtnAddClick + Spacing = 0 + TabOrder = 2 + end + object BtnDelete: TBitBtn + Left = 40 + Height = 25 + Hint = 'Delete selected currency symbol' + Top = 8 + Width = 27 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF003F54C3233A50C27D3853BEDB3551BDF3304BBCF32E4E + B8DB2B4CB77D2748B523FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF004658C8534255C6E63C52CCFF757AE8FF8F92EEFF8F92EEFF7178 + E4FF334DC1FF2B4AB7E6294BB553FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF004D5ACD534959CBF45C65E0FFA1A6F5FF7E86EFFF5B63E9FF595DE7FF7D84 + EEFF9EA0F4FF515DD7FF2B4AB7F4294BB553FFFFFF00FFFFFF00FFFFFF00545F + D2225361CFE5616BE3FFA1ACF5FF545FECFF505CEAFF4D59E9FF4E59E6FF4C56 + E6FF5056E6FF9EA2F4FF5460D6FF2A4AB8E5294BB522FFFFFF00FFFFFF005860 + D47E4B56DBFFA2ABF6FF5664F0FF5266EEFF4D59E9FF4D59E9FF4D59E9FF4D59 + E9FF4C58E6FF525AE6FF9FA3F5FF3450C4FF2A4AB87EFFFFFF00FFFFFF005C62 + D7DB818CEEFF7E91F7FF5D73F3FF4D59E9FF4D59E9FF4D59E9FF4D59E9FF4D59 + E9FF4D59E9FF4F5BE9FF7B83F0FF757BE2FF2E4BBADBFFFFFF00FFFFFF005F63 + DAF6A1ABF7FF7086F8FF6882F6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF4D59E9FF5C66EAFF969CF1FF3250BCF6FFFFFF00FFFFFF006469 + DBF6AFB9F9FF7F93FAFF7085F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF4D59E9FF5E6AEEFF969DF1FF364FBEF6FFFFFF00FFFFFF00676A + DEDBA5AFF5FF9DABFAFF778CF0FF545FECFF545FECFF545FECFF545FECFF545F + ECFF545FECFF6377F2FF818EF4FF787FE9FF3A53C0DBFFFFFF00FFFFFF006A69 + E07E7D83EAFFCDD4FCFF8B9DFAFF7E93F7FF758AEEFF6C84F6FF6C84F6FF6C84 + F6FF6C84F6FF6379F3FFA4AFF8FF3E4FD0FF3E54C27EFFFFFF00FFFFFF006C6C + E1226A69E0E5A3A7F3FFD4DBFDFF879AFAFF7F91F0FF7A8EF1FF7F94F8FF7E92 + F9FF768CF8FFA8B6F8FF636EE3FF4557C7E54156C522FFFFFF00FFFFFF00FFFF + FF006D6CE3536A69E0F4AAADF2FFD8DCFDFFAEBAFAFF91A3FAFF8B9DFAFF9CA9 + FBFFBAC7FCFF707BE9FF4C5BCCF44858CA53FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF006D6CE3536A6ADFE68E93EDFFBEC3F8FFCCD3F9FFC4CBF9FFAAB4 + F4FF6670E2FF535ED1E6505DCE53FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF006D6DE2236B6AE17D686ADDDB6364DCF36164DAF35D63 + D9DB5B63D67D5862D423FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + OnClick = BtnDeleteClick + Spacing = 0 + TabOrder = 3 + end + end +end diff --git a/components/fpspreadsheet/examples/visual/shared/sfcurrencyform.pas b/components/fpspreadsheet/examples/visual/shared/scurrencyform.pas similarity index 58% rename from components/fpspreadsheet/examples/visual/shared/sfcurrencyform.pas rename to components/fpspreadsheet/examples/visual/shared/scurrencyform.pas index 20284729a..48c596d71 100644 --- a/components/fpspreadsheet/examples/visual/shared/sfcurrencyform.pas +++ b/components/fpspreadsheet/examples/visual/shared/scurrencyform.pas @@ -1,32 +1,37 @@ -unit sfCurrencyForm; +unit scurrencyform; {$mode objfpc}{$H+} interface uses - Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - ButtonPanel, StdCtrls, ExtCtrls, Buttons; + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, + ExtCtrls, Buttons; type { TCurrencyForm } TCurrencyForm = class(TForm) + ButtonBevel: TBevel; BtnAdd: TBitBtn; + BtnCancel: TBitBtn; BtnDelete: TBitBtn; - ButtonPanel: TButtonPanel; - LblInfo: TLabel; + BtnOK: TBitBtn; CurrencyListbox: TListBox; - Panel1: TPanel; + LblInfo: TLabel; + ButtonPanel: TPanel; procedure BtnAddClick(Sender: TObject); procedure BtnDeleteClick(Sender: TObject); + procedure BtnOKClick(Sender: TObject); procedure FormCreate(Sender: TObject); - procedure OKButtonClick(Sender: TObject); private { private declarations } + function GetCurrencySymbol: String; + procedure SetCurrencySymbol(const AValue: String); public { public declarations } + property CurrencySymbol: String read GetCurrencySymbol write SetCurrencySymbol; end; var @@ -34,17 +39,14 @@ var implementation +{$R *.lfm} + uses - fpscurrency; + fpsCurrency; + { TCurrencyForm } -procedure TCurrencyForm.FormCreate(Sender: TObject); -begin - GetRegisteredCurrencies(CurrencyListbox.Items); - CurrencyListbox.ItemIndex := CurrencyListbox.Items.Count-1; -end; - procedure TCurrencyForm.BtnAddClick(Sender: TObject); var s: String; @@ -65,14 +67,34 @@ begin CurrencyListbox.Items.Delete(CurrencyListbox.ItemIndex); end; -procedure TCurrencyForm.OKButtonClick(Sender: TObject); +procedure TCurrencyForm.BtnOKClick(Sender: TObject); begin RegisterCurrencies(CurrencyListbox.Items, true); end; +procedure TCurrencyForm.FormCreate(Sender: TObject); +begin + GetRegisteredCurrencies(CurrencyListbox.Items); + CurrencyListbox.ItemIndex := CurrencyListbox.Items.Count-1; +end; -initialization - {$I sfCurrencyForm.lrs} +function TCurrencyForm.GetCurrencySymbol: String; +var + index: Integer; +begin + index := CurrencyListbox.ItemIndex; + if index > -1 then + Result := CurrencyListbox.Items[index] + else + Result := ''; +end; + +procedure TCurrencyForm.SetCurrencySymbol(const AValue: String); +begin + CurrencyListbox.ItemIndex := CurrencyListbox.Items.IndexOf(AValue); +end; end. + + diff --git a/components/fpspreadsheet/examples/visual/shared/sfcurrencyform.lfm b/components/fpspreadsheet/examples/visual/shared/sfcurrencyform.lfm deleted file mode 100644 index e9c75f8d6..000000000 --- a/components/fpspreadsheet/examples/visual/shared/sfcurrencyform.lfm +++ /dev/null @@ -1,81 +0,0 @@ -object CurrencyForm: TCurrencyForm - Left = 361 - Height = 324 - Top = 177 - Width = 278 - Caption = 'Currency symbols' - ClientHeight = 324 - ClientWidth = 278 - Constraints.MinHeight = 166 - Constraints.MinWidth = 172 - OnCreate = FormCreate - Position = poMainFormCenter - LCLVersion = '1.3' - object ButtonPanel: TButtonPanel - Left = 6 - Height = 38 - Top = 280 - Width = 266 - OKButton.Name = 'OKButton' - OKButton.DefaultCaption = True - OKButton.OnClick = OKButtonClick - HelpButton.Name = 'HelpButton' - HelpButton.DefaultCaption = True - CloseButton.Name = 'CloseButton' - CloseButton.DefaultCaption = True - CancelButton.Name = 'CancelButton' - CancelButton.DefaultCaption = True - TabOrder = 2 - ShowButtons = [pbOK, pbCancel] - end - object LblInfo: TLabel - Left = 4 - Height = 20 - Top = 46 - Width = 270 - Align = alTop - BorderSpacing.Around = 4 - Caption = 'These strings indicate currencies:' - ParentColor = False - WordWrap = True - end - object Panel1: TPanel - Left = 0 - Height = 42 - Top = 0 - Width = 278 - Align = alTop - BevelOuter = bvNone - ClientHeight = 42 - ClientWidth = 278 - TabOrder = 0 - object BtnAdd: TBitBtn - Left = 8 - Height = 30 - Top = 8 - Width = 75 - Caption = 'Add' - OnClick = BtnAddClick - TabOrder = 0 - end - object BtnDelete: TBitBtn - Left = 88 - Height = 30 - Top = 8 - Width = 75 - Caption = 'Delete' - OnClick = BtnDeleteClick - TabOrder = 1 - end - end - object CurrencyListbox: TListBox - Left = 4 - Height = 204 - Top = 70 - Width = 270 - Align = alClient - BorderSpacing.Around = 4 - ItemHeight = 0 - TabOrder = 1 - end -end diff --git a/components/fpspreadsheet/examples/visual/shared/sformatsettingsform.lfm b/components/fpspreadsheet/examples/visual/shared/sformatsettingsform.lfm index 4c9207768..387df0b60 100644 --- a/components/fpspreadsheet/examples/visual/shared/sformatsettingsform.lfm +++ b/components/fpspreadsheet/examples/visual/shared/sformatsettingsform.lfm @@ -10,42 +10,43 @@ object FormatSettingsForm: TFormatSettingsForm OnCloseQuery = FormCloseQuery OnCreate = FormCreate Position = poMainFormCenter - LCLVersion = '1.3' + ShowHint = True + LCLVersion = '1.5' object PageControl: TPageControl Left = 8 - Height = 434 + Height = 438 Top = 8 Width = 454 - ActivePage = PgNumber + ActivePage = PgCurrency Align = alClient BorderSpacing.Around = 8 - TabIndex = 0 + TabIndex = 1 TabOrder = 0 OnChange = PageControlChange object PgNumber: TTabSheet Caption = 'Number' - ClientHeight = 401 + ClientHeight = 410 ClientWidth = 446 object LblDecimalSeparator: TLabel Left = 16 - Height = 20 + Height = 15 Top = 19 - Width = 125 + Width = 98 Caption = 'Decimal separator:' ParentColor = False end object LblThousandSeparator: TLabel Left = 16 - Height = 20 + Height = 15 Top = 51 - Width = 134 + Width = 108 Caption = 'Thousand separator:' ParentColor = False end object Label1: TLabel Left = 4 - Height = 20 - Top = 377 + Height = 15 + Top = 391 Width = 438 Align = alBottom BorderSpacing.Around = 4 @@ -56,7 +57,7 @@ object FormatSettingsForm: TFormatSettingsForm object Bevel3: TBevel Left = 0 Height = 3 - Top = 370 + Top = 384 Width = 446 Align = alBottom Shape = bsBottomLine @@ -64,84 +65,84 @@ object FormatSettingsForm: TFormatSettingsForm end object PgCurrency: TTabSheet Caption = 'Currency' - ClientHeight = 401 + ClientHeight = 410 ClientWidth = 446 object LblCurrencySymbol: TLabel Left = 16 - Height = 20 + Height = 15 Top = 20 - Width = 112 + Width = 93 Caption = 'Currency symbol:' FocusControl = EdCurrencySymbol ParentColor = False end object EdCurrencySymbol: TEdit Left = 200 - Height = 28 + Height = 23 Top = 16 - Width = 231 + Width = 202 Anchors = [akTop, akLeft, akRight] OnChange = EdCurrencySymbolChange TabOrder = 0 end object LblCurrencySymbol1: TLabel Left = 16 - Height = 20 + Height = 15 Top = 52 - Width = 163 + Width = 132 Caption = 'Currency decimal places:' FocusControl = EdCurrencyDecimals ParentColor = False end object EdCurrencyDecimals: TSpinEdit Left = 200 - Height = 28 + Height = 23 Top = 48 Width = 66 TabOrder = 1 end object LblPosCurrencyFormat: TLabel Left = 16 - Height = 20 + Height = 15 Top = 84 - Width = 169 + Width = 135 Caption = 'Format of positive values:' FocusControl = CbPosCurrencyFormat ParentColor = False end object CbPosCurrencyFormat: TComboBox Left = 200 - Height = 28 + Height = 23 Top = 80 Width = 231 Anchors = [akTop, akLeft, akRight] - ItemHeight = 20 + ItemHeight = 15 Style = csDropDownList TabOrder = 2 end object LblNegCurrencyFormat: TLabel Left = 16 - Height = 20 + Height = 15 Top = 116 - Width = 174 + Width = 139 Caption = 'Format of negative values:' FocusControl = CbNegCurrencyFormat ParentColor = False end object CbNegCurrencyFormat: TComboBox Left = 200 - Height = 28 + Height = 23 Top = 112 Width = 231 Anchors = [akTop, akLeft, akRight] - ItemHeight = 20 + ItemHeight = 15 Style = csDropDownList TabOrder = 3 end object Label2: TLabel Left = 4 - Height = 20 - Top = 377 + Height = 15 + Top = 391 Width = 438 Align = alBottom BorderSpacing.Around = 4 @@ -152,11 +153,20 @@ object FormatSettingsForm: TFormatSettingsForm object Bevel2: TBevel Left = 0 Height = 3 - Top = 370 + Top = 384 Width = 446 Align = alBottom Shape = bsBottomLine end + object BtnCurrency: TBitBtn + Left = 406 + Height = 25 + Top = 15 + Width = 25 + Caption = '...' + OnClick = BtnCurrencyClick + TabOrder = 4 + end end object PgDateTime: TTabSheet Caption = 'Date/time' @@ -172,11 +182,11 @@ object FormatSettingsForm: TFormatSettingsForm end object CbLongDateFormat: TComboBox Left = 200 - Height = 28 + Height = 23 Top = 16 Width = 231 Anchors = [akTop, akLeft, akRight] - ItemHeight = 20 + ItemHeight = 15 ItemIndex = 0 Items.Strings = ( 'ddd, d/mm/yyyy' @@ -209,11 +219,11 @@ object FormatSettingsForm: TFormatSettingsForm end object CbShortDateFormat: TComboBox Left = 200 - Height = 28 + Height = 23 Top = 48 Width = 231 Anchors = [akTop, akLeft, akRight] - ItemHeight = 20 + ItemHeight = 15 ItemIndex = 0 Items.Strings = ( 'd/m/yy' @@ -297,11 +307,11 @@ object FormatSettingsForm: TFormatSettingsForm end object CbLongTimeFormat: TComboBox Left = 200 - Height = 28 + Height = 23 Top = 248 Width = 231 Anchors = [akTop, akLeft, akRight] - ItemHeight = 20 + ItemHeight = 15 ItemIndex = 1 Items.Strings = ( 'h:n:s' @@ -315,11 +325,11 @@ object FormatSettingsForm: TFormatSettingsForm end object CbShortTimeFormat: TComboBox Left = 200 - Height = 28 + Height = 23 Top = 280 Width = 231 Anchors = [akTop, akLeft, akRight] - ItemHeight = 20 + ItemHeight = 15 ItemIndex = 1 Items.Strings = ( 'h:n' @@ -354,8 +364,8 @@ object FormatSettingsForm: TFormatSettingsForm end object ButtonPanel: TButtonPanel Left = 6 - Height = 38 - Top = 450 + Height = 34 + Top = 454 Width = 458 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True diff --git a/components/fpspreadsheet/examples/visual/shared/sformatsettingsform.pas b/components/fpspreadsheet/examples/visual/shared/sformatsettingsform.pas index f25ce2c8b..b077525fc 100644 --- a/components/fpspreadsheet/examples/visual/shared/sformatsettingsform.pas +++ b/components/fpspreadsheet/examples/visual/shared/sformatsettingsform.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - Grids, ButtonPanel, ComCtrls, StdCtrls, Spin, ExtCtrls, sCtrls; + Grids, ButtonPanel, ComCtrls, StdCtrls, Spin, ExtCtrls, Buttons, sCtrls; type { TFormatSettingsForm } @@ -15,6 +15,7 @@ type Bevel1: TBevel; Bevel2: TBevel; Bevel3: TBevel; + BtnCurrency: TBitBtn; ButtonPanel: TButtonPanel; CbLongDateFormat: TComboBox; CbLongTimeFormat: TComboBox; @@ -48,6 +49,7 @@ type PgCurrency: TTabSheet; PgDateTime: TTabSheet; PgNumber: TTabSheet; + procedure BtnCurrencyClick(Sender: TObject); procedure DateTimeFormatChange(Sender: TObject); procedure EdCurrencySymbolChange(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); @@ -81,7 +83,8 @@ var implementation uses - fpsUtils; + fpsUtils, + sCurrencyForm; const CURR_VALUE = 100.0; @@ -154,6 +157,20 @@ begin // Application.ProcessMessages; end; +procedure TFormatSettingsForm.BtnCurrencyClick(Sender: TObject); +var + F: TCurrencyForm; +begin + F := TCurrencyForm.Create(nil); + try + F.CurrencySymbol := EdCurrencySymbol.Text; + if F.ShowModal = mrOK then + EdCurrencySymbol.Text := F.CurrencySymbol; + finally + F.Free; + end; +end; + procedure TFormatSettingsForm.EdCurrencySymbolChange(Sender: TObject); var currSym: String; diff --git a/components/fpspreadsheet/examples/visual/spready/spready.lpi b/components/fpspreadsheet/examples/visual/spready/spready.lpi index cc6120b3d..1b00b47b9 100644 --- a/components/fpspreadsheet/examples/visual/spready/spready.lpi +++ b/components/fpspreadsheet/examples/visual/spready/spready.lpi @@ -106,31 +106,34 @@ <UnitName Value="mainform"/> </Unit1> <Unit2> - <Filename Value="sctrls.pas"/> + <Filename Value="..\shared\scsvparamsform.pas"/> <IsPartOfProject Value="True"/> + <ComponentName Value="CSVParamsForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> </Unit2> <Unit3> - <Filename Value="..\shared\scsvparamsform.pas"/> + <Filename Value="..\shared\sformatsettingsform.pas"/> <IsPartOfProject Value="True"/> <HasResources Value="True"/> </Unit3> <Unit4> - <Filename Value="..\shared\sfcurrencyform.pas"/> - <IsPartOfProject Value="True"/> - <HasResources Value="True"/> - </Unit4> - <Unit5> - <Filename Value="..\shared\sformatsettingsform.pas"/> - <IsPartOfProject Value="True"/> - <HasResources Value="True"/> - </Unit5> - <Unit6> <Filename Value="..\shared\ssortparamsform.pas"/> <IsPartOfProject Value="True"/> <ComponentName Value="SortParamsForm"/> <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> <UnitName Value="sSortParamsForm"/> + </Unit4> + <Unit5> + <Filename Value="..\shared\sctrls.pas"/> + <IsPartOfProject Value="True"/> + </Unit5> + <Unit6> + <Filename Value="..\shared\scurrencyform.pas"/> + <IsPartOfProject Value="True"/> + <HasResources Value="True"/> + <UnitName Value="scurrencyform"/> </Unit6> </Units> </ProjectOptions> diff --git a/components/fpspreadsheet/examples/visual/spready/spready.lpr b/components/fpspreadsheet/examples/visual/spready/spready.lpr index 02dfee942..51e6de359 100644 --- a/components/fpspreadsheet/examples/visual/spready/spready.lpr +++ b/components/fpspreadsheet/examples/visual/spready/spready.lpr @@ -4,8 +4,8 @@ program spready; uses Interfaces, // this includes the LCL widgetset - Forms, mainform, sCtrls, - scsvparamsform, sfcurrencyform, sformatsettingsform, ssortparamsform; + Forms, mainform, + scsvparamsform, sformatsettingsform, ssortparamsform, sctrls, scurrencyform; {$R *.res}