I'm trying to do something I guess I have never tried before, and so far, am feeling stupid. What I want to do is pass any of three or four different types of TFields (TIntegerField, TFloadField, and TStringField will be primary) as a parameter in a method call. So far, I have not found a workable declaration for the parameter.
I'm trying to do something I guess I have never tried before, and so far, am feeling stupid. What I want to do is pass any of three or four different types of TFields (TIntegerField, TFloadField, and TStringField will be primary) as a parameter in a method call. So far, I have not found a workable declaration for the parameter.
I would have thought it a fairly obvious thing to do, but have turned up nothing useful on Google, either.
I did find an example from Marco's Mastering Delphi 7, where I see (Sender: TField). However, when I tried (AField: TField) in my own code, the compiler complained. Perhaps something in XE7 I haven't puzzled out?
I would have thought it a fairly obvious thing to do, but have turned up nothing useful on Google, either.
I did find an example from Marco's Mastering Delphi 7, where I see (Sender: TField). However, when I tried (AField: TField) in my own code, the compiler complained. Perhaps something in XE7 I haven't puzzled out?
I am not on that machine right now. I will get back to it after my chores are done. ;)
ReplyDeleteYes, it will handle each differently. The usage is in filling cells in a spreadsheet. I could use overloaded methods, but that would merely sidestep the puzzle. I'd like instead to understand it.
TField should definitely work for value parameters. Are you maybe using var ?
ReplyDeleteIt was along day, yesterday. Not sure what happened, but I just went through things again, and now I am able to do just as I wanted.
ReplyDelete