Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Delphi| Formular öffnen. Eine Frage

Empfohlene Antworten

Veröffentlicht

Also ich kann ein Formular mit

Application.CreateForm(TFormmain, Formmain);

oder mit

Formmain:=Tformmain.create(self);

öffnen. Doch wo liegt da der Unterschied? Was wird wie ausgeführt und verarbeitet?

MVG

need-some-blood

Original geschrieben von need-some-blood

Also ich kann ein Formular mit

Application.CreateForm(TFormmain, Formmain);

oder mit

Formmain:=Tformmain.create(self);

öffnen. Doch wo liegt da der Unterschied? Was wird wie ausgeführt und verarbeitet?

Mit Application.createForm wird als Eigentümer des neuen Formulars das Anwendungsobjekt gesetzt (Application).

TFormClass.Create(self) setzt als Eigentümer das Object, das die Methode aufruft (self).

Application.createForm = TFormClass.Create(Application)

Edit:


procedure TApplication.CreateForm(InstanceClass: TComponentClass; var Reference);

var

  Instance: TComponent;

begin

  Instance := TComponent(InstanceClass.NewInstance);

  TComponent(Reference) := Instance;

  try

   [b] Instance.Create(Self);[/b]

  except

    TComponent(Reference) := nil;

    raise;

  end;

[i]

  if (FMainForm = nil) and (Instance is TForm) then

  begin

    TForm(Instance).HandleNeeded;

    FMainForm := TForm(Instance);

  end;

[/i]

end;

Der Unterschied ist, dass u.U. das Hauptformular der Anwendung gesetzt wird. Wenn es also nicht das Erste Formular ist, dass erzeugt wird macht es keinen Unterschied. (siehe fetter bzw. kursiver Bereich oben)

Alles Klar dank dir. :P

MVG

need-some-blood

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.