OK, I've found the problem. It was somewhere else, and I think discovering where the problem was would be beneficial to those who wish to "structure" their OPL programs, so here's what's happened.
As I posted some time ago, I'm trying to isolate the services provided by the "core" from the functionality of the application itself. This should prove a good practice, as once you have a working core, you can translate it and just LOADM it into your program.
My core (adopted thankfully from FreEpoc) has something like that:
AfSetCBAButton😞KCBAButton_1%,G_CBA_Title1$,0,0,"HandleCBA"😉
where KCBAButton_1% is a CONST defined in the core, and G_CBA_Title1$ is a GLOBAL defined in the application (remember: the core and the application are two different modules).
Further on in the core, in the HandleCBA😞button&😉 proc I have:
IF button&=KCBAButton_1% AND len(G_CBA_PROC1$)>0
@(G_CBA_PROC1$):
ENDIF
where G_CBA_PROC1$ is a GLOBAL defined in the application and contains the name of the proc to execute when CBA1 is pressed. This proc (the CONTENTS of G_CBA_PROC1$) resides in the application module.
Now when I wanted to change the title of CBA1 and the proc to be executed, I just put the following in my application:
G_CBA_Title1$="New Title"
G_CBA_PROC1$="other_proc"
AfSetCBAButton😞KCBAButton_1%,G_CBA_Title1$,0,0,"HandleCBA"😉
The above statements were in a proc called by the HandleCBA itself.
If this sounds too complicated, just bear in mind that I wanted to change the titles & procs of the CBAs when CBA1 was pressed, so the code was put in the G_CBA_PROC1$ proc.
And here was the catch:
KCBAButton_1% was defined as CONST only in the core, so the last statement above (AfSetCBAButton) should have caused an error (undefined extrnal), But since it was called from a callback proc, it didn't stop on the error and didn't show it, it just ignored it, thus not changing.
Here are the 2 scenarios:
Scenario1:
----------
Proc Main:
Proc1:
ENDP
Proc Proc1:
AfSetCBAButton😞x%,G_CBA_Title1$,0,0,"HandleCBA"😉
ENDP
This will cause undefined external error on x%
Scenario2:
----------
const x%=1
Proc module:
AfSetCBAButton😞x%,G_CBA_Title1$,0,0,"HandleCBA"😉
endp
proc HandleCBA:
Proc9:
endp
complied into module.opo
proc Main:
loadm "module"
endp
Proc Proc9:
AfSetCBAButton😞x%,G_CBA_Title1$,0,0,"HandleCBA"😉
ENDP
This will NOT cause undefined external error on x%
Too long a post, I hope someone will benefit from it.
NBP