ErrorProvider Xojo Plugin

DesktopErrorProvider.RequestBuddyControl Event

Use this event to solve cases when you have complex embedding and the ErrorProvider fails to embed canvas to display the Error symbol.

RequestBuddyControl(
   source as DesktopUIControl,
   legacySource as RectControl) as DesktopCanvas

Parameters

source
The source control that indicates which error the event applies to. (This can be nil if the source is old style control, in which case the legacySource parameter would contain reference to the control).
legacySource
The legacy source control that indicates which error the event applies to. (This can be nil if the source is new style control, in which case the source parameter would contain reference to the control)

Returns

DesktopCanvas

Remarks

It can fail to embed its own canvas on the fly in complex embedding situation, especially if group boxes that contain canvas are anywhere on the window. Then its good to resort to use this event.

When using this event you place your own canvas at back of your edit field or control that you want to Error validate. Top and Left location don't need to be accurate but it is important that you place it in same nesting hierarchy as the control to be validated.

Rules of buddy control canvases that you assign to the ErrorProvider:
1. No event on them may be wired up (if they are then your application will get exception)
2. It must be one buddy control per control to validate. So if you got 2 Text boxes then you places 2 canvases, both text-boxes cannot share the same.


Function RequestBuddyControl(source as DesktopUIControl, legacySource as RectControl) As DesktopCanvas
    if source = TextField2 then
       return Canvas2
    elseif source = TextField3 then
       return Canvas3
    end if
   
    return nil // For all other controls we choose to not use Buddy control so we return nil
End Function

See Also

DesktopErrorProvider Control