diff --git a/components/tvplanit/examples/demo/demomain.lfm b/components/tvplanit/examples/demo/demomain.lfm index d03003420..2d65b0184 100644 --- a/components/tvplanit/examples/demo/demomain.lfm +++ b/components/tvplanit/examples/demo/demomain.lfm @@ -25,9 +25,9 @@ object MainForm: TMainForm Height = 532 Top = 48 Width = 780 - ActivePage = TabEvents + ActivePage = TabSettings Align = alClient - TabIndex = 0 + TabIndex = 4 TabOrder = 0 object TabEvents: TTabSheet Caption = 'Events' @@ -485,6 +485,30 @@ object MainForm: TMainForm OnChange = Cb3DChange TabOrder = 4 end + object LblAddressBuilder: TLabel + Left = 16 + Height = 15 + Top = 149 + Width = 82 + Caption = 'Address builder' + ParentColor = False + end + object CbAddressBuilder: TComboBox + Left = 112 + Height = 23 + Top = 144 + Width = 172 + ItemHeight = 15 + Items.Strings = ( + '(default)' + '@ZIP @CITY' + '@CITY, @STATE @ZIP' + '@CITY @ZIP' + ) + OnChange = CbAddressBuilderChange + Style = csDropDownList + TabOrder = 5 + end end end object HeaderPanel: TPanel @@ -626,7 +650,7 @@ object MainForm: TMainForm end object VpControlLink1: TVpControlLink DataStore = VpBufDSDataStore1 - LocalizationFile = '../../source\vplocalize.xml' + LocalizationFile = '../../source/vplocalize.xml' Printer.BottomMargin = 0 Printer.DayStart = h_08 Printer.DayEnd = h_05 diff --git a/components/tvplanit/examples/demo/demomain.lrt b/components/tvplanit/examples/demo/demomain.lrt index c46d2ba82..e4b933b3d 100644 --- a/components/tvplanit/examples/demo/demomain.lrt +++ b/components/tvplanit/examples/demo/demomain.lrt @@ -17,6 +17,7 @@ TMAINFORM.LBLTIMEFORMAT.CAPTION=Time format TMAINFORM.LBLFIRSTDAYOFWEEK.CAPTION=First day of week TMAINFORM.CBALLOWINPLACEEDITING.CAPTION=Allow inplace editing TMAINFORM.CB3D.CAPTION=3d display mode +TMAINFORM.LBLADDRESSBUILDER.CAPTION=Address builder TMAINFORM.TITLELBL.CAPTION=TitleLbl TMAINFORM.MENUITEM1.CAPTION=File TMAINFORM.MNUQUIT.CAPTION=Quit diff --git a/components/tvplanit/examples/demo/demomain.pas b/components/tvplanit/examples/demo/demomain.pas index 1995f9306..46228efac 100644 --- a/components/tvplanit/examples/demo/demomain.pas +++ b/components/tvplanit/examples/demo/demomain.pas @@ -24,8 +24,10 @@ type CbFirstDayOfWeek: TComboBox; CbAllowInplaceEditing: TCheckBox; Cb3D: TCheckBox; + CbAddressBuilder: TComboBox; Img: TImage; ImageList1: TImageList; + LblAddressBuilder: TLabel; LblFirstDayOfWeek: TLabel; LblTimeFormat: TLabel; LblGranularity: TLabel; @@ -71,6 +73,7 @@ type procedure BtnNewResClick(Sender: TObject); procedure BtnEditResClick(Sender: TObject); procedure Cb3DChange(Sender: TObject); + procedure CbAddressBuilderChange(Sender: TObject); procedure CbAllowInplaceEditingChange(Sender: TObject); procedure CbFirstDayOfWeekChange(Sender: TObject); procedure CbGranularityChange(Sender: TObject); @@ -252,6 +255,14 @@ begin VpMonthView1.DrawingStyle := ds; end; +procedure TMainForm.CbAddressBuilderChange(Sender: TObject); +begin + if CbAddressBuilder.ItemIndex <= 0 then + VpControlLink1.CityStateZipFormat := '' + else + VpControlLink1.CityStateZipFormat := CbAddressBuilder.Items[CbAddressBuilder.ItemIndex]; +end; + procedure TMainForm.CbAllowInplaceEditingChange(Sender: TObject); begin VpContactGrid1.AllowInplaceEditing := CbAllowInplaceEditing.Checked; diff --git a/components/tvplanit/languages/demo.de.po b/components/tvplanit/languages/demo.de.po index d768cb9cd..1f8c26d0e 100644 --- a/components/tvplanit/languages/demo.de.po +++ b/components/tvplanit/languages/demo.de.po @@ -157,6 +157,10 @@ msgstr "Editieren an Ort und Stelle erlauben" msgid "30 Min" msgstr "30 Min" +#: tmainform.lbladdressbuilder.caption +msgid "Address builder" +msgstr "" + #: tmainform.lblfirstdayofweek.caption msgid "First day of week" msgstr "Die Woche beginnt am" diff --git a/components/tvplanit/languages/demo.po b/components/tvplanit/languages/demo.po index 351c39fbe..82e944eba 100644 --- a/components/tvplanit/languages/demo.po +++ b/components/tvplanit/languages/demo.po @@ -146,6 +146,10 @@ msgstr "" msgid "30 Min" msgstr "" +#: tmainform.lbladdressbuilder.caption +msgid "Address builder" +msgstr "" + #: tmainform.lblfirstdayofweek.caption msgid "First day of week" msgstr "" diff --git a/components/tvplanit/source/vpbaseds.pas b/components/tvplanit/source/vpbaseds.pas index f2046c257..de68aaf4b 100644 --- a/components/tvplanit/source/vpbaseds.pas +++ b/components/tvplanit/source/vpbaseds.pas @@ -358,11 +358,13 @@ type FLocalization : TVpLocalization; FLocalizationFile : string; FDefaultCountry : string; + FCityStateZipFormat: String; protected{private} DependentList: TList; procedure Attach (Sender : TComponent); procedure Detach (Sender : TComponent); procedure ReleaseDependents; + procedure SetCityStateZipFormat(const Value: String); procedure SetDataStore (const Value : TVpCustomDataStore); procedure SetDefaultCountry (const v : string); procedure SetLocalizationFile (const v : string); @@ -378,6 +380,8 @@ type procedure TriggerOnPageStart (Sender: TObject; PageNum: Integer; ADate: TDateTime); property Localization : TVpLocalization read FLocalization write FLocalization; published + property CityStateZipFormat: String read FCityStateZipFormat write SetCityStateZipFormat; + // Use symbols @CITY, @STATE, @ZIP to define the order of these strings property DataStore: TVpCustomDataStore read FDataStore write SetDataStore; property DefaultCountry : string read FDefaultCountry write SetDefaultCountry; property LocalizationFile : string read FLocalizationFile write SetLocalizationFile; @@ -1336,6 +1340,12 @@ begin end; {=====} +procedure TVpControlLink.SetCityStateZipFormat(const Value: String); +begin + if FCityStateZipFormat <> Value then + FCityStateZipFormat := Value +end; + procedure TVpControlLink.SetDataStore(const Value: TVpCustomDataStore); begin if FDataStore <> Value then diff --git a/components/tvplanit/source/vpcontactgrid.pas b/components/tvplanit/source/vpcontactgrid.pas index 3b2a71d03..8b158fd33 100644 --- a/components/tvplanit/source/vpcontactgrid.pas +++ b/components/tvplanit/source/vpcontactgrid.pas @@ -216,6 +216,7 @@ type procedure LoadLanguage; procedure LinkHandler(Sender: TComponent; NotificationType: TVpNotificationType; const Value: Variant); override; + function GetCityStateZipFormat: String; function GetControlType : TVpItemType; override; procedure DeleteActiveContact(Verify: Boolean); procedure PaintToCanvas (ACanvas: TCanvas; ARect: TRect; Angle: TVpRotationAngle); @@ -518,6 +519,13 @@ begin end; {=====} +function TVpContactGrid.GetCityStateZipFormat: String; +begin + if ControlLink <> nil then + Result := ControlLink.CityStateZipFormat else + Result := ''; +end; + function TVpContactGrid.GetControlType : TVpItemType; begin Result := itContacts; diff --git a/components/tvplanit/source/vpcontactgridpainter.pas b/components/tvplanit/source/vpcontactgridpainter.pas index 2f6882c5b..c907930b6 100644 --- a/components/tvplanit/source/vpcontactgridpainter.pas +++ b/components/tvplanit/source/vpcontactgridpainter.pas @@ -46,6 +46,7 @@ type implementation uses + StrUtils, VpCanvasUtils, VpMisc, VpSR; type @@ -415,15 +416,24 @@ begin DrawContactLine(TmpBmp, TmpCon.Address, '', WholeRect, AddrRect); { do City, State, Zip } - Str := TmpCon.City; - if Str <> '' then - Str := Str + ', ' + TmpCon.State - else - Str := TmpCon.State; - if Str <> '' then - Str := Str + ' ' + TmpCon.Zip - else - Str := TmpCon.Zip; + str := FContactGrid.GetCityStateZipFormat; + if str = '' then + begin + str := TmpCon.City; + if (str <> '') and (TmpCon.State <> '') then + Str := Str + ', ' + TmpCon.State; + if (str <> '') and (TmpCon.Zip <> '') then + Str := Str + ' ' + TmpCon.Zip; + end else + begin + Str := ReplaceStr(Str, '@CITY', TmpCon.City); + Str := ReplaceStr(Str, '@STATE', TmpCon.State); + Str := ReplaceStr(Str, '@ZIP', TmpCon.Zip); + while (Length(Str) > 0) and (Str[1] in [' ', ',', '.']) do + Delete(Str, 1, 1); + while (Length(Str) > 0) and (Str[Length(Str)] in [' ', ',', '.']) do + Delete(Str, Length(Str), 1); + end; DrawContactLine(TmpBmp, Str, '', WholeRect, CSZRect); { do Phone1 }