![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
переменные [D5]
875 © (2006-02-07 10:22:00)Добрый день.
Нужно написать прогу с множеством форм
Может кто подскажет как можно сделать что бы переменная объявленная в 1 модуле была доступна и в других модулях?
Ega23 (2006-02-07 11:40:00) [1]
unit FirstUnit;
interface
type
TForm1=class(TForm)
private
FX:Integer;
public
property X:Integer Read FX Write FX;
end;
var
Form1:TForm1;
GlobalVariableX:Integer;
function SetGlobalVariableX:Integer;
implementation
function SetGlobalVariableX:Integer;
begin
Result:=Form1.FX;
end;
end.
//*************************************
unit SecondUnit;
interface
uses FirstUnit
type
TForm2=class(TForm)
private
FY:Integer;
public
property Y:Integer Read FY Write FY;
end;
var
Form2:TForm2;
implementation
// Здесь из юнита FirstUnit будет доступно:
// 1. Объект Form1 клааса TForm1;
// 2. Переменная GlobalVariableX типа Integer
// 3. функция SetGlobalVariableX
end.
DesWind (2006-02-07 11:39:00) [2]
unit MyForm_u;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TMyForm = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
MyForm: TMyForm;
......
end.
unit Unit1;
uses
MyForm_u;
......
MyForm.Show;
.........
end.
evvcom (2006-02-07 11:10:00) [3]Судя по
> Нужно написать прогу с множеством форм... что бы переменная объявленная в 1 модуле
эта переменная - "форма", объявленная IDE Delphi, поэтому она точно не в привате. Хотя как знать?
pupapumQ (2006-02-07 11:02:00) [4]Но нужно чтоб переменная была объявлена не в private
evvcom (2006-02-07 10:24:00) [5]Прописать в uses дригихмодулей этотмодуль.