Einzelnen Beitrag anzeigen

Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#17

AW: FormatSettings for Dummies

  Alt 13. Apr 2016, 11:33
Nur mal so gesagt:
1. Warum kommt hier Label.Caption := FormatDateTime(Now, FormatSettings.ShortDateFormat) 12/04/2016 statt 12.04.2016 ?
Das kann ich noch nicht einmal kompilieren

Das hier schon
Label1.Caption := FormatDateTime( FormatSettings.ShortDateFormat, Now ); Hier mal ein kleines Beispielprogramm, wo man auch live die Änderungen sehen kann
Delphi-Quellcode:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.AppEvnts;

type
  TForm1 = class( TForm )
    Label1: TLabel;
    ApplicationEvents1: TApplicationEvents; { OnSettingChange = ApplicationEvents1SettingChange }
    procedure ApplicationEvents1SettingChange(Sender: TObject; Flag: Integer;
      const Section: string; var Result: Integer);
    procedure FormShow(Sender: TObject);
  private
    procedure PresentData;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ApplicationEvents1SettingChange(Sender: TObject; Flag: Integer;
  const Section: string; var Result: Integer);
begin
  PresentData;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  PresentData;
end;

procedure TForm1.PresentData;
begin
  Label1.Caption := FormatDateTime( FormatSettings.ShortDateFormat, Now );
end;

end.
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  Mit Zitat antworten Zitat