AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

global Variablen, Mehrfachdeklaration

Ein Thema von WS1976 · begonnen am 11. Sep 2007 · letzter Beitrag vom 17. Sep 2007
Antwort Antwort
Nuclear-Ping
(Gast)

n/a Beiträge
 
#1

Re: global Variablen, Mehrfachdeklaration

  Alt 12. Sep 2007, 04:16
Wenn ich solche "globalen" Variablen brauche, mache ich es ungefähr so:

Delphi-Quellcode:
unit MyGlobals;

interface

type
  ...

const
  ...

var
  ...;
  MyGlobVar: String;

implementation

end.
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, ..., MyGlobals;

type
  ...

implementation

procedure TForm1.FormCreate (...);
begin
  MyGlobVar := 'Foo';
end;

...

end.
Delphi-Quellcode:
unit Unit2;

interface

uses
  Windows, ..., MyGlobals;

type
  ...

implementation

procedure TForm2.FormCreate (...);
begin
  ShowMessage (MyGlobVar);
end;

...

end.
Also eine Unit anlegen, in der solche Sachen gesammelt werden (Types, Consts, Vars) und diese Unit dann in den jeweiligen Units einbinden, wo du die Variablen / Typen / ... brauchst.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:55 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz