Changeset 100 for trunk/Forms


Ignore:
Timestamp:
Feb 8, 2022, 5:13:22 PM (2 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.
Location:
trunk/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.lfm

    r95 r100  
    1818    Top = 8
    1919    Width = 1009
    20     ActivePage = TabSheetWork
     20    ActivePage = TabSheetGeneral
    2121    Anchors = [akTop, akLeft, akRight, akBottom]
    2222    ParentFont = False
    23     TabIndex = 2
     23    TabIndex = 0
    2424    TabOrder = 0
    2525    object TabSheetGeneral: TTabSheet
     
    114114        Height = 43
    115115        Top = 442
    116         Width = 265
     116        Width = 216
    117117        ParentFont = False
    118118        TabOrder = 14
     
    229229        Height = 43
    230230        Top = 442
    231         Width = 265
     231        Width = 217
    232232        ParentFont = False
    233233        TabOrder = 15
     
    334334        ImageIndex = 16
    335335        OnClick = SpeedButtonEmailClick
     336        ShowHint = True
     337        ParentShowHint = False
     338      end
     339      object SpeedButtonBirthDay: TSpeedButton
     340        Left = 372
     341        Height = 43
     342        Hint = 'Select date'
     343        Top = 442
     344        Width = 43
     345        Images = Core.ImageList1
     346        ImageIndex = 17
     347        OnClick = SpeedButtonBirthDayClick
     348        ShowHint = True
     349        ParentShowHint = False
     350      end
     351      object SpeedButtonAniversary: TSpeedButton
     352        Left = 821
     353        Height = 43
     354        Hint = 'Select date'
     355        Top = 442
     356        Width = 43
     357        Images = Core.ImageList1
     358        ImageIndex = 17
     359        OnClick = SpeedButtonAniversaryClick
    336360        ShowHint = True
    337361        ParentShowHint = False
     
    436460        TabOrder = 6
    437461        object Label36: TLabel
    438           Left = 8
     462          Left = 10
    439463          Height = 27
    440464          Top = 19
     
    572596        Images = Core.ImageList1
    573597        ImageIndex = 15
    574         OnClick = peedButtonHomeWebClick
     598        OnClick = SpeedButtonHomeWebClick
    575599        ShowHint = True
    576600        ParentShowHint = False
     
    13651389  object PopupMenuPhoto: TPopupMenu
    13661390    Images = Core.ImageList1
    1367     Left = 483
    1368     Top = 508
     1391    Left = 872
     1392    Top = 592
    13691393    object MenuItem1: TMenuItem
    13701394      Action = APhotoLoad
     
    13781402  end
    13791403  object OpenPictureDialog1: TOpenPictureDialog
     1404    Title = 'Open existing file'
    13801405    Left = 175
    13811406    Top = 575
    13821407  end
    13831408  object SavePictureDialog1: TSavePictureDialog
     1409    Title = 'Save file as'
    13841410    Left = 176
    13851411    Top = 488
    13861412  end
     1413  object CalendarDialog1: TCalendarDialog
     1414    Title = 'Select date'
     1415    Date = 44600
     1416    OKCaption = '&OK'
     1417    CancelCaption = 'Cancel'
     1418    Left = 448
     1419    Top = 608
     1420  end
    13871421end
  • trunk/Forms/UFormContact.lrj

    r95 r100  
    2121{"hash":262626066,"name":"tformcontact.speedbuttonweb.hint","sourcebytes":[79,112,101,110,32,105,110,32,119,101,98,32,98,114,111,119,115,101,114],"value":"Open in web browser"},
    2222{"hash":102887636,"name":"tformcontact.speedbuttonemail.hint","sourcebytes":[79,112,101,110,32,105,110,32,101,109,97,105,108,32,99,108,105,101,110,116],"value":"Open in email client"},
     23{"hash":171928085,"name":"tformcontact.speedbuttonbirthday.hint","sourcebytes":[83,101,108,101,99,116,32,100,97,116,101],"value":"Select date"},
     24{"hash":171928085,"name":"tformcontact.speedbuttonaniversary.hint","sourcebytes":[83,101,108,101,99,116,32,100,97,116,101],"value":"Select date"},
    2325{"hash":325173,"name":"tformcontact.tabsheethome.caption","sourcebytes":[72,111,109,101],"value":"Home"},
    2426{"hash":138641338,"name":"tformcontact.label7.caption","sourcebytes":[69,45,109,97,105,108,58],"value":"E-mail:"},
     
    9294{"hash":8431845,"name":"tformcontact.aphotoload.caption","sourcebytes":[76,111,97,100,32,102,114,111,109,32,102,105,108,101],"value":"Load from file"},
    9395{"hash":9308581,"name":"tformcontact.aphotosave.caption","sourcebytes":[83,97,118,101,32,116,111,32,102,105,108,101],"value":"Save to file"},
    94 {"hash":4860802,"name":"tformcontact.aphotoclear.caption","sourcebytes":[67,108,101,97,114],"value":"Clear"}
     96{"hash":4860802,"name":"tformcontact.aphotoclear.caption","sourcebytes":[67,108,101,97,114],"value":"Clear"},
     97{"hash":218146437,"name":"tformcontact.openpicturedialog1.title","sourcebytes":[79,112,101,110,32,101,120,105,115,116,105,110,103,32,102,105,108,101],"value":"Open existing file"},
     98{"hash":159035875,"name":"tformcontact.savepicturedialog1.title","sourcebytes":[83,97,118,101,32,102,105,108,101,32,97,115],"value":"Save file as"},
     99{"hash":171928085,"name":"tformcontact.calendardialog1.title","sourcebytes":[83,101,108,101,99,116,32,100,97,116,101],"value":"Select date"},
     100{"hash":11067,"name":"tformcontact.calendardialog1.okcaption","sourcebytes":[38,79,75],"value":"&OK"},
     101{"hash":77089212,"name":"tformcontact.calendardialog1.cancelcaption","sourcebytes":[67,97,110,99,101,108],"value":"Cancel"}
    95102]}
  • 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.