WithEvents

VB had something called WithEvents…

Is this a question or a statement? :slight_smile:

Well… I was working on a container control defining events so that the events from controls within the control could be propagated outside the control… I had hoped for an easier way to click on a control within the control and define event automatically for me.
Maybe there is a way to define an interface based on a control… thus the thoughts about with events …

Could you add an Event Definition to your container then use Raise Event to pass the event up?

right-clic on an event in a container control, and at the bottom of the menu you can create the same event definition.

Thanks Hal. It’s not that I don’t know how to define an event, it’s that I don’t know how to define 10 events all at once… rather than having to do it manually for each event that is just a duplicate to be propagated up.

Xojo is quite different from VB. It is better if you start with the user guide. it has a secction about events.

I know what are you meaning, lets say I have a contaier A with n events well defined, and a container B with owns events, when I need embeed container B into container A I use EmbedWithin or EmbedWithinPanel, how about events of container B, you need use AddHandler, create Methods to handle events, ok, but need to Raise an event of container A with n parameters of event of container B, I don’t know the type and the numbers of parameters of event, you can create a event in container A with parameterArray of type Object or Variant, thats is my solution. Think in a containers you haven’t created, but want to sopport it.

Sometimes that’s the way to do it. You can Copy and Paste Event definitions from the child to the parent to propagate them.