I am confused… When one uses addhandler for an event one is essentially assigning a delegate for method to that event handler, and that method can have method parameters of any type including strings and objects…
But it seems not to be so for a method explicitly defined as a Delegate in the IDE…
That does not make sense to me…maybe it’s its Xojo trying to be overprotective because this use was not originally envisioned?
In this case I am not using delegates to call external/OS but just as function pointer objects for Xojo methods that can be passed as a parameter to another Xojo method.
I have a delegate created in a module defined as:
Public Function DBToDataTypesDelegate(Source as SourceDB, DBType as DBColumnType, FieldName as String) as DataTypes
Where the parameters are (enum, Enum, String) as Enum
Elsewhere were I try to do: (SpecialCaseMethod does have the right signature)
Dim theDelegate as New DBtoDatatypesDelegate(AddressOf SpecialCaseMethod)
I get a compile error on the Delegate definition saying:
[quote]External functions cannot use ordinary strings as parameters. Use CString, PString, WString, or CFStringRef instead.
But this is NOT for an external function and event delegates are not limited like this…
In this case the string will always fit in a PString, so I chnaged teh delegate to use a SPtring…
BUT that added to teh overhead of converting a string to a PString and then back from a PString to a String… which is not great but it does work and I can pass the function as method parameter.
Is this because of something I am missing, a bug (the docs don’t say delegates are limited to external methods) or shortsighted design combined with less than complete documentation?
In other words, a bug report or feature request?