Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2008.02.17;
Скачать: CL | DM;

Вниз

Народ , подскажите плз . Есть в проекте на delphi два файла   Найти похожие ветки 

 
smartleds   (2008-01-25 16:35) [0]

Один файл обрабатывает кнопки файл 1, у другого просто процедуры файл 2.
В файле 1 я объявил динамическую матрицу , заполнил ее данными , задал размер, и даже распечатал.
Когда пытаюсь из второго файла обратится к этой матрицы , то данных в ней нет, одни нули , во втором файле матрицу никак не объявлял.
Подскажите что за фигня.


 
Palladin ©   (2008-01-25 16:38) [1]

первая строчка меня убила...


 
Семеныч   (2008-01-25 16:39) [2]

Если к матрице обратиться, когда она еще не заполнена - что будет?


 
smartleds   (2008-01-25 16:41) [3]

Так я ее вначале заполняю, печатаю все это в файле 1, потом перехожу к форме файла два нажимаю кнопку чтобы распечатать, а там одни нули.


 
Семеныч   (2008-01-25 16:44) [4]

Чудес не бывает. Давайте код.


 
clickmaker ©   (2008-01-25 16:53) [5]


> Так я ее вначале заполняю, печатаю все это в файле 1, потом
> перехожу к форме файла два нажимаю кнопку чтобы распечатать

зачем?
форма 2 печатает как-то иначе?


 
smartleds   (2008-01-25 16:59) [6]

Вот код файл 1 Жмем кнопку заполнить матрицу Full matrica потом Print смотрим что получилось , и потом кнопку Show откроется вторая форма и при открытии формы опять матрица выводится и там одни нули, могу сразу проект выслать.
Файл 1
unit palitra_daslight;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, StdCtrls, ComCtrls;
const amount_channels=3;
type
 TForm1 = class(TForm)
   Button3: TButton;
   Memo1: TMemo;
   Button5: TButton;
   Button6: TButton;
   procedure FormCreate(Sender: TObject);
   procedure Button3Click(Sender: TObject);
   procedure Button5Click(Sender: TObject);
   procedure Button6Click(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;
//================- Discription Variables -=======
//var  amount_scene, amount_service_arrays,curtime:integer;
//================- Discription Arrays -==========
var matrica_scene: array of array of byte; // index 1--> stroka (row), index 2-->stolb(colomn)
var
 Form1: TForm1;

implementation

uses show;

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
SetLength(matrica_scene,1000,512); // 1-->amount scene ; 3--> amount channels

end;
//-------------- Button Show ------
procedure TForm1.Button3Click(Sender: TObject);
begin
form2.show;
end;
//---------------- Button Full Matrica ------------
procedure TForm1.Button5Click(Sender: TObject);
begin
SetLength(matrica_scene,2,8); // 1-->amount scene ; 3--> amount channels

matrica_scene[0,0] :=181;
matrica_scene[0,1] :=181;
matrica_scene[0,2] :=181;
matrica_scene[0,3] :=101;
matrica_scene[0,4] :=1;
matrica_scene[0,5] :=1;
matrica_scene[0,6] :=1;
matrica_scene[0,7] :=1;
//---------------------
matrica_scene[1,0] :=20;
matrica_scene[1,1] :=20;
matrica_scene[1,2] :=20;
matrica_scene[1,3] :=11;
matrica_scene[1,4] :=1;
matrica_scene[1,5] :=1;
matrica_scene[1,6] :=1;
matrica_scene[1,7] :=1;

end;
//--------------- Button Print ----
procedure TForm1.Button6Click(Sender: TObject);
var i,j:integer;
var st:string;
begin
for i:=0 to 2-1 do
   begin //0
  for j:=0 to 8-1 do
         begin //1
         st:=st+inttostr(matrica_scene[i,j])+" ";
          end; //1
   st:=st+#13;
   end; //0
showmessage(st);
form1.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[0,0])+"  ");
form1.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[0,1])+"  ");
form1.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[0,2])+"  ");
form1.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[1,0])+"  ");
form1.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[1,1])+"  ");
form1.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[1,2])+"  ");

end;
end.
=============================Конец файла 1===============
Файл 2
unit show;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, ExtCtrls, StdCtrls, ComCtrls;

type
 TForm2 = class(TForm)
   Memo1: TMemo;
   procedure FormCreate(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;
//================- Discription Variables -=======
var timerflag,count,curscene,curindex_delay :integer;
//================- Discription Arrays -==========
//var matrica_scene: array of array of byte; // index 1--> stroka (row), index 2-->stolb(colomn)
var
 Form2: TForm2;

implementation

uses palitra_daslight;

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
begin
form2.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[0,0])+"  ");
form2.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[0,1])+"  ");
form2.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[0,2])+"  ");
form2.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[1,0])+"  ");
form2.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[1,1])+"  ");
form2.Memo1.Lines.Append("matrica="+inttostr(matrica_scene[1,2])+"  ");
end;

end.


 
smartleds   (2008-01-25 17:01) [7]

(to clickmaster) Я печатаю на форме два для того чтобы посмотреть что с матрицей, потому что процедура которой я ее скармливаю находится в файле 2 и не работает.


 
Сергей М. ©   (2008-01-25 17:03) [8]


> первая строчка меня убила


А а, говнюк, гляжу на такие строчки и реагирую чучть более бурно.


 
Семеныч   (2008-01-25 17:05) [9]

Обработчик TForm2.OnCreate уберите, а код из него перенесите в обработчик TForm2.OnShow.

А еще лучше - сделайте форму TForm2 неавтосоздаваемой.


 
engine ©   (2008-01-25 17:07) [10]

> [7] smartleds   (25.01.08 17:01)

У тебя формы autocreate.


 
smartleds   (2008-01-25 17:10) [11]

А в чем косяк, у меня что форма создается до того как матрица заполняется?


 
Семеныч   (2008-01-25 17:16) [12]

> smartleds   (25.01.08 17:10) [11]

Да. Посмотрите в код файла DPR - увидите.


 
smartleds   (2008-01-25 17:54) [13]

Спасибо !



Страницы: 1 вся ветка

Текущий архив: 2008.02.17;
Скачать: CL | DM;

Наверх




Память: 0.5 MB
Время: 0.026 c
2-1201003051
deras
2008-01-22 14:57
2008.02.17
Первый и последний дни месяца.


3-1191395182
zorik
2007-10-03 11:06
2008.02.17
MySQL и Delphi


2-1201155932
Василий К.
2008-01-24 09:25
2008.02.17
Extended в TThread и его деление...


15-1200148474
No_Dead
2008-01-12 17:34
2008.02.17
Вот как бы сформулировать получше?


2-1201181350
IC+
2008-01-24 16:29
2008.02.17
Получить путь к объекту из ярлыка (lnk)