Показать сообщение отдельно
  #26  
Старый 25.02.2015, 21:53
Аватар для roland196
roland196 roland196 вне форума
Прохожий
 
Регистрация: 24.02.2015
Адрес: Литва
Сообщения: 22
Версия Delphi: Turbo Delphi 10
Репутация: 10
Восклицание

ну в ообщем не заработало
исходник от angvelem - работает - переменная передается.

сделал также = обе формы заполнил идентично с исходником angvelem:


Код:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    SpeedButton1: TSpeedButton;
    procedure SpeedButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  Hide;
  Form2.N2 := 196;
  Form2.Show;
end;

end.


Код:
unit Unit2;

interface

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

type
  TForm2 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    N2 : Integer;
  end;

var
  Form2: TForm2;

implementation

uses
  Unit1;

{$R *.dfm}

procedure TForm2.FormShow(Sender: TObject);
begin
  Label2.Caption := IntToStr(N2);
end;

procedure TForm2.Button1Click(Sender: TObject);
begin
  Hide;
  Form1.Show;
end;

end.


но у меня переменная из N2 Form1 в Form2 Label2.Caption := IntToStr(N2);
НЕ передается

может што то в свойствах форм или кнопки Speedbutton нужно записать?
__________________
не переставай удивляться обычному
Ответить с цитированием