Link to home
Start Free TrialLog in
Avatar of eNarc
eNarcFlag for United Kingdom of Great Britain and Northern Ireland

asked on

TFrame Function Problem

Hi I'd like to be able to activate a action within a function within a tframe. though for some reason I can't do it?
object Frame2: TFrame2
  Left = 0
  Top = 0
  Width = 320
  Height = 240
  TabOrder = 0
  TabStop = True
  object Edit1: TEdit
    Left = 72
    Top = 48
    Width = 121
    Height = 21
    TabOrder = 0
    Text = 'Edit1'
  end
  object Button1: TButton
    Left = 72
    Top = 75
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 1
    OnClick = Button1Click
  end
end
 
 
 
 
==========================================================
 
 
 
unit Unit2;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
 
type
  TFrame2 = class(TFrame)
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
implementation
 
{$R *.dfm}
 
function Start:string;
begin
frame2.edit1.text:='tt';
end;
 
function finish:string;
begin
start;
 
 
end;
 
 
procedure TFrame2.Button1Click(Sender: TObject);
begin
finish;
end;
 
end.

Open in new window

Avatar of Geert G
Geert G
Flag of Belgium image

why do you mix methods and proc/funcs like this ?
what are you trying to achieve ?

next to that your function results are not defined ...

this may be just a sample but it brings just more questions than simplify

when calling a function from a frame from within the form and this is not a method of the frame, it is better to pass the form and/or frame as a parameter
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eNarc

ASKER

thankyou, your a life saver, you truly are, I thought it was something self, though when I did self, it declared it as being unknown, and now I see how you've done it :D and yea, it has to be declared, should have known hehe thankyou :D
Avatar of eNarc

ASKER

thankyou :)