Passing an event up to a container

I’m trying to produce a container control that will allow entry of an angle (or a time interval) in either DMS (HMS) or decimal degrees (hours).

The image below shows the control in question. It contains 3 container controls (one for each of D, M, and S) each with a slider and a text field so changing either the slider or the text field will update the other. The outer container also has a text field (on the right) that is to display the angle in decimal degrees.

My question is, how do I get changes in each of the internal (slider/textfield) containers to immediately change the value in the outer decimal degrees field?

Define an event in your container control (valueChanged for instance)
and raise it when the sliders change their value or the text field or raise it for every situation you need.

for a better solution you can create a computed property in the container control, change the value for every case you need, then in the Set function raise the event. the “reader” of the event will read this value (or you can read it when ever you need)


Thanks for your reply. The problem I am having is that I have a container within a container and I don’t know how to pass an event from the inner container to the outer container. Is there something I should be researching to get a handle on this?

In other words, how can the outer container know that there was been a change in one of the controls of the inner container?


you can replicate the same thing for every container involved.

In the sub container define the event and raise it when you need.

In the “super” container reply to the new define event of your sub container.

It the “super” container is a sub of a another container, then define an event and as “reply” of the sub container event raise your event.


I don’t fully understand what you are saying but you have given me something to research and that was what I was hoping for. I’m not sure what you mean by:

In the “super” container reply to the new define event of your sub container.

but I will look into defining and raising events.

Many thanks.


Add an event definition to the inner container (the class itself, not the one on the outer container.) Then go to the outer container and add the corresponding event handler to the inner container used there. Switch back to the inner container class and you can raise the event by calling it like a method (e.g. MyEvent(Someparam, Someotherparam).)

Here you go Peter:

Thanks to everyone for your replies. Very helpful, I’ve got my head around it now.