I have a function where I’d like to ensure that the delegate was constructed via weakAddressOf. However I can’t seem to find a way to determine this.
Am I missing something or should I file a feature request?
I have a function where I’d like to ensure that the delegate was constructed via weakAddressOf. However I can’t seem to find a way to determine this.
Am I missing something or should I file a feature request?
I don’t know if I really understand what your request is … Do you want to know if it was set with weakAddressOf or AddressOf, or do you just want to know if it was set correctly? In the second case I think just check if it is different from nil.
Yes, I want to know if the delegate was created using weakAddressOf or not,
Check these functions in our plugins: GetDelegateParametersMBS, GetDelegateTargetMBS and GetDelegateWeakMBS.
Ask Xojo to expose a read-only “Address” so you can use things like
If mydelegate <> Nil And mydelegate.Address isa WeakRef Then ...
The three things I query via plugin could be official properties on the delegates.
Internally it seems to be a class generated by the compiler.
That is what I shall do, thanks.
Or maybe myDelegate.BaseObect() which could return a reference (of type Object) to the object that owns the method. It could return Nil if the delegate didn’t refer to an object method or if it is a weak version and the object has already been destroyed. Basically how WeakRef.Value() works.
Done <https://xojo.com/issue/65683>, thanks all for your input.
You missed my older cases http://feedback.xojo.com/case/20844 and http://feedback.xojo.com/case/26060
Sorry, feedback didn’t show me any previous cases when I tried to create this case.
Not a problem for me. Each case asks for a bit different thing.
And Xojo Inc. could update the delegates someday and do most of this requests together.