Oct 13, 2010 at 11:00 AM
Edited Oct 13, 2010 at 11:03 AM
I am trying to build a dataform control that consumes a Entity and displays its fields. I am almost done but I need a bit of advice.
There comes a time where I need to set up some cal:Message.Attaches from code behind on a control's Loaded event. I do this by calling Message.SetAttach( statusComboBox, "[Event LostFocus]=[Action StatusLostFocus]"); inside of statusComboBox's
Loaded event. Then CM does its magic and we are ready to go. Or not?
Seems like CM uses the Loaded event of controls to call ActionMessage.ElementLoaded which in turn calls ActionMessage.UpdateContext(); The problem is that since the action messages are set up
inside the loaded event this step never takes place. Does this mean that you can never add action messages to controls from within their Loaded Events.
Is there some chance that you could make this possible? I have to currently hack ActionMessage.Invoke and do a null check on ActionMessage.context before continuing. If the context is null I call UpdateContext and it works, but I am not sure how legal/safe
this hack is.
Any ideas how I can set a control's action messages from its Loaded event otherwise?