Custom Control Event

Hi All,

I have a custom control for date entry, it has some format validation in the LostFocus event. What should I do if I need to do something more in 2 different windows? For instance, in Window A, I want to copy the value to another variable, while in Window B I want to show a calendar event for that day.

Can anyone teach me how? Thanks.

use eventbus_JJ search the forums

in the custom control subclass add an Event Definition
Name it “IsValid” it should have a parameter - possibly a date
It should return a boolean
In your lostfocus code you raise this event and pass the date
The return value tells you if the date is valid

When you put instances of this control on layouts now you can have each layout do extra validation if you want

Then you add a second event definition - Changed(d as date)
This one you only use raise event in your lost focus IF the the date is valid
Again this lets instances on windows do whatever they want with the changed date

IF you need to broadcast this change to several windows then something like eventbus would be useful