I have a dialog with many user-entry fields, and many read-only fields that have their values automatically calculated based on the user's input. I've derived from the save_dlg::corresp class in order to make this processing easier, but now I'm a bit stuck on how to get the updated data into the read-only fields.
I plan on having those fields updated during the derived corresp::init_ctrl() function, but I'm not entirely sure how to go about calling save_dlg::load(). Should I be storing a reference to the save_dlg itself, and within my processing functions, call m_save_dlg.load(), or is there a better way to do it?
Alternatively, I could create my own dialog class and from within the validator functions post a message that the class should re-load the calculated fields, but that seems like I'm reinventing the save_dlg wheel.
Thanks for the help.
If I understand you correctly, this is what you should do:
- create a "read-only" correspondence (that is, simply put, a "Get-only" function).
On every change, this function will be called, and if necessary, the read-only controls will be updated.
Please let me know if this helps.
Wow, that's really simple.
Just to make sure I'm understanding you correctly, when the user makes a change to ANY field on the dialog, every "read-only" correspondence gets called?
That's pretty neat, if true. It also means I should make those functions lightweight if there's a lot of them.
Is there a way for me to tell which field got changed last? That would be an interesting addition to save_dlg::info - an int that held the resource id of the field that caused the update.