As of 4D v13, the commands FORM GOTO PAGE and FORM Get current page can be called in the context of a subform using the optional * parameter. This is useful with subforms containing multiple pages.
The following demonstrates how the 4D command FORM GOTO PAGE can be used in a subform with tab controls:
When the standard action of a tab control object in a subform is set to "Goto Page," the page of the parent form will change rather than having the page in the subform change as desired. In the image below, the standard action "Goto Page" is selected. The second tab ("Page 2") from the subform is selected, making the current page of the parent form change to page 2 while the current page of the subform stays on page 1.
Using the standard action "Goto Page" is equivalent to having no standard action and having the following code in the subform's tab control object method:
Case of : (Form event=On Clicked) FORM GOTO PAGE(Self->) End case |
In order for the tabs in the subform to change the page of the subform (and not the page of the parent form) no standard action should be selected and the command FORM GOTO PAGE should be used with the optional * parameter. The above code should instead be:
Case of : (Form event=On Clicked) FORM GOTO PAGE(Self->;*) End case |
Now, the current page of the subform will be changed upon selecting tabs in the subform rather than having the current page of the parent form change.