I’ve started getting an error message when I click the View Source button.
The templates do not support Virtual Embed Editing
I cant find any reference to Virtual Embed Editing in the help docs.
I’ve had quite a few appgen template error messages popping up today which I’ve never seen before in life but this is one that keeps appearing when I try to view embed in source.
I’ve actually seen that error somewhat recently. I was using a set of Clarion 5 Legacy templates, registered in Clarion 11. When I did a right-click, Embeditor Source, on a procedure, it failed. It could edit embeds in the embed tree, but it could not use the embeditor.
I have not yet done a comparison between the C5 and C11 Legacy templates to determine the specific cause, but I imagine it’s something in the #PROCEDURE template, probably something quite simple. (Or maybe you are not embedding in a Procedure? Global Embeds for example can’t be “sourced” in this way.)
I found it, it needs this code, but there is nothing in the help docs which mentions this Virtual Embed Editing.
#! This section is the Embed Editor's View Source button
#! It needs to be after the #Application #Sheet/#Tab prompts section &
#! before anything else in the #Application section otherwise
#! the rest of the code is processed which can take a long time
#! The only exception to this is if any of that code before it is needed
#! to help process/generate code in the Procedure.
#! #Call(%DT,%T,'#IF(%EditProcedure['& %EditProcedure &'])')
#IF(%EditProcedure)
#CREATE(%EditFilename) #Call(%DT,%T,'#CREATE(%EditFilename['& %EditFilename &'])')
#Call(%DT,%T,'#FIND(%ModuleProcedure['& %ModuleProcedure &'],%EditProcedure['& %EditProcedure &'])')
#FIND(%ModuleProcedure,%EditProcedure) #Call(%DT,%T,'#FIX(%Procedure['& %Procedure &'],%ModuleProcedure['& %ModuleProcedure &'])')
#FIX(%Procedure,%ModuleProcedure) #Call(%DT,%T,'#MESSAGE(''Generating Module: '' & %Module['& %Module &'],1)')
#MESSAGE('Generating Module: ' & %Module,1) #Call(%DT,%T,'#MESSAGE(''Generating Procedure: '' & %Procedure['& %Procedure &'],2)')
#MESSAGE('Generating Procedure: ' & %Procedure,2) #Call(%DT,%T,'#GENERATE(%Procedure['& %Procedure &'])')
#GENERATE(%Procedure) #Call(%DT,%T,'#COMMENT(60)')
#COMMENT(60) #Call(%DT,%T,'#CLOSE')
#CLOSE #Call(%DT,%T,'#ABORT')
#ABORT
#ENDIF #Call(%DT,%T,'#ENDIF')
The #Call(%DT template code on the right is a template #group that sends a message to debugview that I can toggle on and off using #Prompt(‘Toggle Debugview messages’,Check),%T in the #Application prompts. You can also use this to spot bugs in templates and work out ways to optimise the shipping templates.