1

Topic: Does not see global variable

Described a variable id_user as global. But for some reason in other units it does not see!!
I will not understand why!
Here a piece of the principal unit:
[spoiler]

unit polyclinic;
interface
uses
Winapi. Windows, Winapi. Messages, System. SysUtils, System. Variants, System. Classes, Vcl. Graphics;
Vcl. Controls, Vcl. Forms, Vcl. Dialogs, Data. DB, Data. Win. ADODB, Vcl. DBCtrls;
Vcl. ComCtrls, System. ImageList, Vcl. ImgList, Vcl. ToolWin, Vcl. StdCtrls;
Vcl. ExtCtrls;
type
TForm1 = class (TForm)
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
DataSource1: TDataSource;
StatusBar1: TStatusBar;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ImageList1: TImageList;
Panel1: TPanel;
Label1: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
Label2: TLabel;
Edit1: TEdit;
CheckBox1: TCheckBox;
Button1: TButton;
Image1: TImage;
ToolButton3: TToolButton;
procedure FormActivate (Sender: TObject);
procedure Button1Click (Sender: TObject);
procedure CheckBox1Enter (Sender: TObject);
procedure ToolButton1Click (Sender: TObject);
procedure ToolButton2Click (Sender: TObject);
procedure FormCreate (Sender: TObject);
procedure ToolButton3Click (Sender: TObject);
private
{Private declarations}
public
{Public declarations}
end;
var
Form1: TForm1;
id_user:integer;
implementation
{$R *.dfm}
uses Unit2, Unit3, Unit4, Unit5;

[/spoiler]
The moderator: Use a tag (button) SRC for code design, please.

2

Re: Does not see global variable

In what place does not see?
The code show.

3

Re: Does not see global variable

And if you even in uses polyclinic did not register that the code can not show.:-D

4

Re: Does not see global variable

THANKS!!
Forgot that the unit named non-standard.)

5

Re: Does not see global variable

terlalex wrote:

var
Form1: TForm1;
id_user:integer;
implementation

and for global variables yet do not shoot?

6

Re: Does not see global variable

For Application, Screen too to shoot?

7

Re: Does not see global variable

DimaBr wrote:

for Application, Screen too to shoot?

At first write
And then there are type councils

wrote:

terlalex;
Units see only that want. .., add "polyclinic" in the list uses sections interface each unit.

interface
uses polyclinic...;

8

Re: Does not see global variable

andreymx wrote:

it is passed...
At first write
And then there are type councils
it is passed...

So you on a personal example show, how it is necessary. That to sense from yours discontent and censure. Struggle with  the code! Always. Everywhere. Even in Zaporozhye!

9

Re: Does not see global variable

Under global constants and variables (if they are necessary) I select one or two units
1. DataModule
2. A unit with constants and global functions-procedures of the current project
In one project there is global  no type a form
In one subordinate unit never there are no links to the principal form or a unit with the principal form
All subordinate forms are caused through type functions/interfaces

function Create_New_zayavka (
p_pred, p_cex, p_kodgr_b, p_id_3123, p_NKS_job_id_nsi3119: variant
) : boolean;
implementation
{$R *.dfm}
function Create_New_zayavka (
p_pred, p_cex, p_kodgr_b, p_id_3123, p_NKS_job_id_nsi3119: variant
) : boolean;
var
Zayavka_row_form: TZayavka_row_form;
msg: string;
begin
msg: = ";
result: = false;
Zayavka_row_form: = TZayavka_row_form. Create (Application);
try
Zayavka_row_form. ZayavState: = TZS_before_new_doc;
Zayavka_row_form.p_pred: = p_pred;
Zayavka_row_form.p_cex: = p_cex;
Zayavka_row_form.p_kodgr_b: = p_kodgr_b;
Zayavka_row_form.p_id_3123: = p_id_3123;
Zayavka_row_form.p_NKS_job_id_nsi3119: = p_NKS_job_id_nsi3119;
Zayavka_row_form. InitData;
if Zayavka_row_form.p_error_in_created then exit;
result: = Zayavka_row_form. ShowModal = Mr_ok;
finally
Zayavka_row_form. Free;
end;
end;

10

Re: Does not see global variable

andreymx wrote:

in one project there is global  no type a form
In one subordinate unit never there are no links to the principal form or a unit with the principal form
All subordinate forms are caused through type functions/interfaces

Initial.dpr at once under a knife or the main form forms where?.

11

Re: Does not see global variable

alekcvp wrote:

it is passed...
Initial.dpr at once under a knife or the main form forms where?.

at once it is corrected as it is necessary

12

Re: Does not see global variable

, from methods of the form there are no links to the form like MainForm. Caption: = ' My Hogwash'

13

Re: Does not see global variable

andreymx wrote:

, from methods of the form there are no links to the form like MainForm. Caption: = ' My Hogwash '

Is an occasion to pride? wink

14

Re: Does not see global variable

rgreat wrote:

it is passed...
It is an occasion to pride? wink

is not present

15

Re: Does not see global variable

wrote:

andreymx;
Fantastic tales.

I welcome critical remarks
Yours faithfully, Andrey

16

Re: Does not see global variable

wrote:

andreymx;
There are no remarks.
If the code is compiled without errors - it is fine.

allow with you disagrees

17

Re: Does not see global variable

wrote:

andreymx;
On you you will not please.

also it is not necessary smile

18

Re: Does not see global variable

Do, do. The main thing when baths get from all slots, again ' the curve ' Delhi was not guilty.

19

Re: Does not see global variable

Your Kep;
T9 Angrily, and for absence of editing in 21 a century it is necessary to beat a candelabrum on cheeks.