I created a custom controller that I use across many forms. It’s selected as the controller in those forms (no tabless tabpanels) and the buttons in it work fine. What I need is a way to enable and disable certain buttons on the controller (or change their visibility) depending on what form is showing - for example, show a Sort button if a list form is active.
I have an enableButtons method on the controller form with a SWITCH statement that determines the active form, and I call enableButtons in the onRecordSelection event of the controller (as I have previous and next buttons, too). This calls the method as you would expect, with one caveat: if I go to a new form via a link in the main form (not the controller), enableButtons is called from onRecordSelection, but getting the name of the current form returns the previous form, rather than the one about to be shown. The method isn’t called again when the new form is shown.
I am using currentcontroller.getName() to get the name of the current form…
This seems like a perfect solution to enabling the buttons if I could just fix the issue with going to another form. I recall it working not too long ago, but I could be crazy. So, first I want to check if this is a bug introduced in rc3. Then, if this is the expected behavior, how do others handle custom controllers in this situation? Is my only option to call enableButtons from the onShow event of each form that uses this controller?