开发者

Can I put a method call in a component property at design time?

Is it p开发者_如何学运维ossible to put a placeholder for a method call in the property value of an object in the Object Inspector? I have a method that returns a string that I'd like to include as part of the connection-string properties of some TADOConnection objects. Changing the method's return value would alter what gets assigned to each of the connections as they're loaded from the DFM.

I'm using RAD Studio 2010.


No, you cant. You can only have properties and events, but:

You can create a set method in you Connection property. This set method you search all forms and datamodules in you application and it will try to find an TADOConnection. When it finds one, it willl change its connection property. But this will only works in design time in the current form you put your component into, but it would work fine on runtime. Thats is not a pleasent solution, maybe you should try what @TommyA said on comments.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜