Forum > General
GEtting a unit to perform a procedure in another
(1/1)
captian jaster:
--- Code: --- unit MainMenuU;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
Menus, NewWalletU;
type
{ TForm1 }
TForm1 = class(TForm)
MainMenu: TMainMenu;
Walletitem: TMenuItem;
WalletB: TMenuItem;
NewB: TMenuItem;
SpentB: TMenuItem;
procedure NewBClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.NewBClick(Sender: TObject);
begin
end;
initialization
{$I MainMenuU.lrs}
end.
--- End code ---
My main menu..
--- Code: --- unit NewWalletU;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls;
type
{ TForm2 }
TForm2 = class(TForm)
Label1: TLabel;
private
{ private declarations }
public
{ public declarations }
end;
var
Form2: TForm2;
implementation
initialization
{$I NewWalletU.lrs}
end.
--- End code ---
New Wallet unit...
I tried putting a procedure in NewWalletU and when i tried to compile it said my procedure identifier was not found..
davesimplewear:
Are you trying to call a procedure from NewWalletU in MainMenuU ?
--- Code: ---unit MainMenuU;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
Menus;
type
{ TForm1 }
TForm1 = class(TForm)
MainMenu: TMainMenu;
Walletitem: TMenuItem;
WalletB: TMenuItem;
NewB: TMenuItem;
SpentB: TMenuItem;
procedure NewBClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
uses NewWalletU;
{ TForm1 }
procedure TForm1.NewBClick(Sender: TObject);
begin
with Form2 do
begin
//call procedure here
end;
end;
initialization
{$I MainMenuU.lrs}
end.
--- End code ---
captian jaster:
thanks
Navigation
[0] Message Index