Recent

Author Topic: GEtting a unit to perform a procedure in another  (Read 5051 times)

captian jaster

  • Guest
GEtting a unit to perform a procedure in another
« on: March 11, 2010, 04:45:28 pm »
Code: [Select]
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.
My main menu..

Code: [Select]
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.
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

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: GEtting a unit to perform a procedure in another
« Reply #1 on: March 11, 2010, 09:39:51 pm »
Are you trying to call a procedure from NewWalletU in MainMenuU ?
Code: [Select]
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.
All things considered insanity seems the best option

captian jaster

  • Guest
Re: GEtting a unit to perform a procedure in another
« Reply #2 on: March 12, 2010, 04:03:48 pm »
thanks

 

TinyPortal © 2005-2018