Mike, I sent you some files with my extended QPage and QPagePanel solution, but sorry for the lack of explanations (documentation will come some day, you know how this goes).
Just to point a new modification regarding this topic: I've created three new overridable hooks to handle data in QPage and QPagePanels:
- Page/Panel_FetchData(): Literally, to fetch data from the DB (that is, to issue a query to load active records).
- Page/Panel_BindData(): To bind this data from the active record to the form controls.
- Page/Panel_StoreData(): To put the data from the controls into the active record again, ready to be saved into DB with a client issued action.
- Also, pages and panels now have a property flag “RefreshDataOnRequest” that intelligently propagates to child panels.
It works this way:
- For data view pages/panels, you set “RefreshDataOnRequest” to true. This way, _FetchData() and _BindData() are automatically called after _Create() and after _Load(), so after any request you always have a fresh snapshot of the current DB data binded to the controls in your screen.
- For data maintenance pages/panels, you set “RefreshDataOnRequest” to false. This way, _FetchData() and _BindData() are only called after _Create(), so maintenance of the data within the controls is up to the form. The _StoreData method is triggered to put back the controls' data into the active record again, just after _Validate() (if it validates, of course) and just before TriggerActions(). This way, after any request this active record always reflects the data contained in the form controls, and it's ready to be saved with a triggered action.
Also to note: The way all these hooks propagate from pages to panels and from panels to child panels has slightly changed to be more flexibily overridable. So the two files I sent to you don't reflect the current state of things.
Tell me what you think about my solution. I think it's 100% “QCodo-ish”, and it's valid also for people not using QCodo active records made with codegen.