Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-15-2009, 10:36 AM
autocorect autocorect is offline
Senior Member
 
Join Date: Mar 2005
Posts: 725
Default function with TComponent as parameter

Hi,

I have 2 function:


function ReadX(ted:TEdit):string ;
begin
if ted.text='bla' then result:=HAX(SomeTEdit) // hear it'sthe problem
else result:=ted.text ;
end ;

function HaX(ted:TEdit):string ;
begin
result:=ted.text;
end ;

I whant to do this:

procedure Doit;
begin
x.text:=Read(Edit1) ;
end ;
----
HAX(SomeTEdit) -> how can I call function if the tedit(params) it's dinamic, I know the name of the TEDIT (params).
Reply With Quote
  #2  
Old 01-15-2009, 09:03 PM
Leo Leo is offline
Member
 
Join Date: Jul 2007
Posts: 30
Default RE: function with TComponent as parameter

Just do like below:

TEdit(FindComponent('Edit1'))
Reply With Quote
  #3  
Old 01-15-2009, 09:14 PM
chris_w chris_w is offline
Senior Member
 
Join Date: Jan 2004
Posts: 1,397
Default RE: function with TComponent as parameter

HaX is declared after ReadX so ReadX does not know what HaX is. Just move the declaration of HaX above the declaration of ReadX.

Chris
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 08:40 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.