Ignore:
Timestamp:
Feb 8, 2022, 5:13:22 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Added workaround for missing GTK2 first mouse click event in contact window.
  • Added: Button for changing contact birth day and anniversary.
  • Fixed: Use english texts in file and directory dialogs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.pas

    r95 r100  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    99  ComCtrls, ActnList, Menus, ExtCtrls, ExtDlgs, Buttons, UContact, LCLIntf,
    10   UFormProperties;
     10  UFormProperties, DateUtils{$IFDEF LCLGTK2}, Gtk2Globals{$ENDIF};
    1111
    1212type
     
    2323    ButtonOk: TButton;
    2424    ButtonPrevious: TButton;
     25    CalendarDialog1: TCalendarDialog;
    2526    EditAim: TEdit;
    2627    EditCategories: TEdit;
     
    173174    PopupMenuPhoto: TPopupMenu;
    174175    SavePictureDialog1: TSavePictureDialog;
     176    SpeedButtonBirthDay: TSpeedButton;
     177    SpeedButtonAniversary: TSpeedButton;
    175178    SpeedButtonHomeEmail: TSpeedButton;
    176179    SpeedButtonEmail: TSpeedButton;
     
    195198    procedure FormDestroy(Sender: TObject);
    196199    procedure FormShow(Sender: TObject);
    197     procedure peedButtonHomeWebClick(Sender: TObject);
     200    procedure SpeedButtonHomeWebClick(Sender: TObject);
     201    procedure SpeedButtonAniversaryClick(Sender: TObject);
     202    procedure SpeedButtonBirthDayClick(Sender: TObject);
    198203    procedure SpeedButtonEmailClick(Sender: TObject);
    199204    procedure SpeedButtonHomeEmailClick(Sender: TObject);
     
    246251  UCore, UCommon;
    247252
     253function DateToISO(Date: TDateTime): string;
     254begin
     255  Result := FormatDateTime('yyyy-mm-dd', Date);
     256end;
     257
    248258{ TFormContact }
    249259
    250260procedure TFormContact.FormShow(Sender: TObject);
    251261begin
     262  {$IFDEF LCLGTK2}
     263  // GTK2 bug workaround https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/35720
     264  if Visible then LastMouse.WinControl := PageControlContact.ActivePage;
     265  {$ENDIF}
    252266  Core.PersistentForm1.Load(Self);
    253267
     
    266280end;
    267281
    268 procedure TFormContact.peedButtonHomeWebClick(Sender: TObject);
     282procedure TFormContact.SpeedButtonHomeWebClick(Sender: TObject);
    269283begin
    270284  if EditHomeWeb.Text <> '' then OpenURL(EditHomeWeb.Text);
     285end;
     286
     287procedure TFormContact.SpeedButtonAniversaryClick(Sender: TObject);
     288var
     289  Date: TDateTime;
     290begin
     291  if TryISOStrToDate(EditAniversary.Text, Date) then
     292    CalendarDialog1.Date := Date
     293    else CalendarDialog1.Date := Now;
     294  if CalendarDialog1.Execute then
     295    EditAniversary.Text := DateToISO(CalendarDialog1.Date);
     296end;
     297
     298procedure TFormContact.SpeedButtonBirthDayClick(Sender: TObject);
     299var
     300  Date: TDateTime;
     301begin
     302  if TryISOStrToDate(EditBirthday.Text, Date) then
     303    CalendarDialog1.Date := Date
     304    else CalendarDialog1.Date := Now;
     305  if CalendarDialog1.Execute then
     306    EditBirthday.Text := DateToISO(CalendarDialog1.Date);
    271307end;
    272308
Note: See TracChangeset for help on using the changeset viewer.