Hi

I want to pass a function name (Y) as a procedure parameter. Can someone 
tell me how to do this? My current solution was OK (just) for a couple 
of forms but unwieldy and non-expandable for even 4 forms. I suspect the 
answer is something to do with addresses and pointers but I have not 
found a solution.

I have had two dead-end thoughts:
1. I could make a TMyForm which embeds the function Y but I am already 
using this for something else and the number of types would double.
2. If  the routine (RoutineX) were on a Form rather than a Unit, I could 
set the calling Form as a property there before jumping over.


Bobbie Clarke


Problem

FormA, contains function Y, and calls RoutineX which wants to use 
function Y
FormB, contains function Y, and calls RoutineX which wants to use 
function Y


Current Solution

Unit UFormA

public
   function Y(...)

  RoutineX(...,self);          // here I would prefer to pass the 
function name Y

function TFormA.Y(...)



Unit Library

procedure RoutineX(...,SendForm:TForm);
...
  if         (SendForm is TFormA) then Y1 := (SendForm as TFormA).Y(...)
  else if (SendForm is TFormB) then Y1 := (SendForm as TFormB).Y(...)




-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to