sincerely
Singaporean
If you have not done so, read this full tutorial on how to use SGEXTN to build an application.
See here for the previous part of the tutorial.
In the previous part, we wrote the code to set up the inftroduction page inside the class SGCLPIntroductionPage.
With the introduction page ready, we can test it by pressing the run button and seeing what happens.
Still the same thing???
We have not asked SGEXTN to run SGCLPIntroductionPage::initialise yet. To fix that, we can declare a new function inside SGCLPIntroductionPage
static void activate();
We then implement the function by making it call SGWBackground::enable to show the introduction page.
void SGCLPIntroductionPage::activate(){ SGWBackground::enable(SGCLPIntroductionPage::instance, &SGCLPIntroductionPage::initialise, nullptr); }
Here the reset function is nullptr as we do not need any. The reset function is supposed to be used for setting default values to input fields.
We then go to src/main.cpp, add the preprocessor include directive
#include <SGCLPIntroductionPage.h>
and add the line
SGXCentral::customInitialise = &SGCLPIntroductionPage::activate;
inside the implementation of init.
This tells the SGEXTN entry point to run SGCLPIntroductionPage::activate immediately after SGEXTN itself is all set up.
We can then test again.
The introduction page now shows as expected. Excellent. Remember to commit this to Git.
Usually, this will not work because the source file was never added to the CMakeLists.txt, but in SGEXTN, that is handled automatically by BuildLah ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ so you do not have to worry about it.
See here for the next part of the tutorial.
©2025 05524F.sg (Singapore)