troubleshooting Question

TObject.MethodAddress doesn't work at design time

Avatar of Meldrachaun
Meldrachaun asked on
24 Comments2 Solutions1249 ViewsLast Modified:
I've spent the last two days trying to get the MethodAddress function to work in Delphi 2006, and it's not working.  Here's the scenario - I'm trying to save a variable number of method pointers in a TStringList property of a custom, non-visual component.  Converting the TMethod objects to string names, using the TObject.MethodName function, works correctly, and writes the data to the .dfm file.  But when the form data is loaded back in, and the Loaded method is called, I can't convert the string data back to TMethod pointers because the TObject.MethodAddress function returns 0.  Note, however, that the MethodAddress function works correctly at run time - it only fails at design time.  I've tried doing a PostMessage in the loaded method, to delay the conversion of the string data to method pointers, but at design time the message never gets processed.  I've even tried hard coding method name lookups into the designer (in the ToolsAPI), just for testing, but the designer doesn't have the method address either.  The Form.Designer property is nil when Loaded is called.  Any suggestions?
Russell Libby
Software Engineer, Advisory
Join our community to see this answer!
Unlock 2 Answers and 24 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 24 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros