Template to add correct template embeded point

Hi all,

 I want to add an template which, show the current sorting field name. I can find out the correct embeded point to add the code, but cannot add the template embeded code in the template. Can anyone give me some suggestion?

I want to add the following code into the following embed point

BRW1.SetSort PROCEDURE(BYTE NewOrder,BYTE Force)
after ! Start of "Browser Method Code Section" 5001

Loc:displaystring = 'show header'

In my template, I add the following :

#AT(%BrowserMethodCodeSection,%ActiveTemplateInstance,‘SetSort’,’(BYTE NewOrder,BYTE Force)’),PRIORITY(5001)
Loc:displaystring = ‘show header’
#ENDAT

Does I use wrong key word to define the embeded point?

Regards

Terry Ho

If your template is a child of BrowseBox template, then try %ActiveTemplateParentInstance instead of %ActiveTemplateInstance.

HI Mike,

Thanks your advice, but still can not make it to work. Noting happen in my designed embeded point.

Regards

Terry Ho

It works for me, here is the part of my template:

#EXTENSION(HtmlBrowseBox,'Html browse box'),PROCEDURE,REQ(EasyHtmlGloExt),REQ(BrowseBox(ABC)),DESCRIPTION('Html browse box '& %ezhVar)

  #DECLARE(%ThisBrowseBoxInstance)
  #SET(%ThisBrowseBoxInstance, %ActiveTemplateParentInstance)

#AT(%BrowserMethodCodeSection,%ThisBrowseBoxInstance,'ResetQueue','(BYTE ResetMode)'),WHERE(NOT %ezhDisable),PRIORITY(2500),DESCRIPTION('Html browse box instance: ResetQueue')
#CALL(%SetFilterIfBlankLocator)
#ENDAT

There was a #CODE Template you put into an APP Embed that generated the #AT(). You can look in Clarion Mag, I think it was written by Andrew Guidroz

In my Template folder I found EmbedInfo.TPL by Lee White @lodestar. Below is the code and also attached.

#!
#!  +-------------------------------------------------------------------------+
#!  |                                                                         |
#!  | Copyright(c) 1998 Lodestar Software                                     |
#!  |                                                                         |
#!  | Provided "as is" with no warranty implied or otherwise!                 |
#!  |                                                                         |
#!  +-------------------------------------------------------------------------+
#!
#TEMPLATE(EmbedDefs,'Embed definitions'),FAMILY('CW20','ABC')
#!-----------------------------------------------------------------------------
#CODE(Embed_Info,'Embed definition and info')
#!-----------------------------------------------------------------------------
#DECLARE(%TwoParams)
#DECLARE(%ParamString)
#SET(%TwoParams,0)
#IF(%EmbedParameters)
  #SET(%TwoParams,INSTRING(',',%EmbedParameters,1,1))
  #IF(%TwoParams)
    #SET(%ParamString,'''' & CLIP(LEFT(SUB(%EmbedParameters,1,%TwoParams-1))) & ''',''' & CLIP(LEFT(SUB(%EmbedParameters,%TwoParams+1,LEN(%EmbedParameters)))) & '''')
!>> #AT(%EmbedID,%ParamString),PRIORITY(????)
  #ELSE
!>> #AT(%EmbedID,'%EmbedParameters'),PRIORITY(????)
  #ENDIF
#ELSE
!>> #AT(%EmbedID),PRIORITY(????)
#ENDIF
!>> Description: %EmbedDescription
#IF(VAREXISTS(%ProcessType))
!>> Process....: %ProcessType
#ENDIF
#IF(VAREXISTS(%ThisObjectName))
!>> Object.....: %ThisObjectName
#ENDIF

EmbedInfo.tpl (1.5 KB)

I found Andrew Guidroz’s template in the June 2001 issue for the article “Creating #AT Statements The Easy Way”. It appears to be based on Lee’s template above with maybe some changes for ABC. I attached article PDF and TPL.

EmbedInfo_ABC.tpl (1.8 KB)

Article PDF

cmag-2001-06_Pages4-6.pdf (67.1 KB)

#!
#TEMPLATE(EmbedDefs_ABC,'Embed definitions'),FAMILY('ABC')
#! https://clarionmag.jira.com/wiki/download/attachments/399455/cmag-2001-06.pdf?api=v2
#!-----------------------------------------------------------------------------
#CODE(Embed_Info_ABC,'Embed definition and info ABC Andrew Guidroze')
#DISPLAY('From ClarionMag June 2001')
#DISPLAY('Article: Creating #AT Statements The Easy Way')
#DISPLAY('By Andrew Guidroz')
#!
#!Original name was Embeds.TPW in download cmag-2001-06.zip v3n6embeds.zip
#!-----------------------------------------------------------------------------
#DECLARE(%TwoParams,LONG)
#DECLARE(%ThirdParams,LONG)
#DECLARE(%ParamString,STRING)
#IF(%EmbedParameters)
  #CLEAR(%TwoParams)
  #SET(%TwoParams,INSTRING(',',%EmbedParameters,1,1))
  #IF(%TwoParams)
    #IF(SUB(%EmbedParameters,(%TwoParams+2),1) <> '(') 
        #SET(%ThirdParams,INSTRING(',',%EmbedParameters,1,%TwoParams+2))
        #SET(%ParamString,'''' & SUB(%EmbedParameters,1,(%TwoParams-1)) & ''',''' & SUB(%EmbedParameters,(%TwoParams+2),((%ThirdParams) - (%TwoParams+2))) & ''',''' & SUB(%EmbedParameters,(%ThirdParams+2),LEN(%EmbedParameters)) & '''')
    #ELSE
        #SET(%ParamString,'''' & SUB(%EmbedParameters,1,(%TwoParams-1)) & ''',''' & SUB(%EmbedParameters,(%TwoParams+2),LEN(%EmbedParameters)) & '''')
    #END
!>> #AT(%EmbedID,%ParamString),PRIORITY( ???? )
  #ELSE
!>> #AT(%EmbedID,'%EmbedParameters'),PRIORITY( ???? )
  #ENDIF
#ELSE
!>> #AT(%EmbedID),PRIORITY( ???? )
#ENDIF
!>> !! What follows is debugging info
!>> EmbedID........... = %EmbedID
!>> EmbedParameters... = %EmbedParameters
!>> Description....... = %EmbedDescription
!>> Process........... = %ProcessType
!>> Object............ = %ThisObjectName
!>> TwoParams ........ = %TwoParams
!>> ThreeParams....... = %ThirdParams

Both templates in use. The #AT() is the same (in this example), more comments in the newer template.

image

There is actually a built-in template that shows the #AT statement for an embed point. Do recall exactly which version this become available.

1 Like

Thanks Rick! I wondered why I had not registered those older templates.

Below is that CreateAtFromEmbed compared to the others. Its better using %ActiveTemplateInstance instead of '1'. AG’s provides more debug.

1 Like

Below are for the actual embeds of BRW1.SetSort the OP wanted to use with the info template output.

Looks like he’s missing the return ,BYTE

Current: '(BYTE NewOrder,BYTE Force)'
Correct: '(BYTE NewOrder,BYTE Force),BYTE'

So when using something like the CreateAt embed template, you have to drop to source to see what the active template embed instance really is you cant see it from an embed code template windows as the two pics below demonstrate.

The 1st pic is my jumped up version of the CreateAt embed code template and the list box ***(last few entries) cant display the active template info *** You cant see this in the pic! so there is a note below it which says, drop to the source to see the complete embed info.

The 2nd picture shows the information it writes which is only visible from source and it shows the proper active template embed. Its a minor limitation of the out the box templates, unless you are using something like #RunDll and an additional dll to do more work.

And because there can be lots of active templates running, one of the other tabs on my jumped up embedinfo template lists all the active template instances just to make sure its easier to track down the right instance as seen in the image below

But because it doesnt maximise to full screen, I can send the info from the list box to a seperate viewer like notepad, notepad++ or even another instance of Clarion. A copy of the text is below:

1 IS_BlankColumnLocal(AAAIntelligentSiliconLtd)
2 IS_CtrlAltPLocal(AAAIntelligentSiliconLtd)
3 IS_Paramslocal(AAAIntelligentSiliconLtd)
4 IS_COMMSlocal(AAAIntelligentSiliconLtd)
5 IS_SetFontProcExtLocal(AAAIntelligentSiliconLtd)
6 IS_AppInfoLocal(AAAIntelligentSiliconLtd)
7 IS_MessagesToDebugViewLocal(AAAIntelligentSiliconLtd)
8 CloseButton(ABC)
9 IS_SubClassLocal(AAAIntelligentSiliconLtd)
10 IS_EmbedInfo(AAAIntelligentSiliconLtd)

ActiveTemplate:                     IS_BlankColumnLocal(AAAIntelligentSiliconLtd)
ActiveTemplateInstance:             1               
ActiveTemplateOwnerInstance(Global):1
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  IS_BlankColumn - Add a local string variable to be a blank column in a list boxes/browses    
ActiveTemplateType:                 EXTENSION                   

ActiveTemplate:                     IS_CtrlAltPLocal(AAAIntelligentSiliconLtd)
ActiveTemplateInstance:             2               
ActiveTemplateOwnerInstance(Global):2
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  IS_CtrlAltP - Popup Procedure and module name    
ActiveTemplateType:                 EXTENSION                   

ActiveTemplate:                     IS_Paramslocal(AAAIntelligentSiliconLtd)
ActiveTemplateInstance:             3               
ActiveTemplateOwnerInstance(Global):4
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  IS_ParameterPrototyper - Procedure Parameter Prototype    
ActiveTemplateType:                 EXTENSION                   

ActiveTemplate:                     IS_COMMSlocal(AAAIntelligentSiliconLtd)
ActiveTemplateInstance:             4               
ActiveTemplateOwnerInstance(Global):3
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  IS_COMMS - A bit flag communication system    
ActiveTemplateType:                 EXTENSION                   

ActiveTemplate:                     IS_SetFontProcExtLocal(AAAIntelligentSiliconLtd)
ActiveTemplateInstance:             5               
ActiveTemplateOwnerInstance(Global):5
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  IS_SetFont - Sets the font properties for windows and controls    
ActiveTemplateType:                 EXTENSION                   

ActiveTemplate:                     IS_AppInfoLocal(AAAIntelligentSiliconLtd)
ActiveTemplateInstance:             6               
ActiveTemplateOwnerInstance(Global):6
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  IS_AppInfo - Gives access to Application template info    
ActiveTemplateType:                 EXTENSION                   

ActiveTemplate:                     IS_MessagesToDebugViewLocal(AAAIntelligentSiliconLtd)
ActiveTemplateInstance:             7               
ActiveTemplateOwnerInstance(Global):7
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  IS Send Messages to DebugView    
ActiveTemplateType:                 EXTENSION                   

ActiveTemplate:                     CloseButton(ABC)
ActiveTemplateInstance:             8               
ActiveTemplateOwnerInstance(Global):0
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  Close the Window    
ActiveTemplateType:                 CONTROL                   

ActiveTemplate:                     IS_SubClassLocal(AAAIntelligentSiliconLtd)
ActiveTemplateInstance:             9               
ActiveTemplateOwnerInstance(Global):9
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  IS_SubClass - Subclass this procedure    
ActiveTemplateType:                 EXTENSION                   

ActiveTemplate:                     IS_EmbedInfo(AAAIntelligentSiliconLtd)
ActiveTemplateInstance:             10               
ActiveTemplateOwnerInstance(Global):0
ActiveTemplateParentInstance:       0         
ActiveTemplatePrimaryInstance:              
ActiveTemplateInstanceDescription:  Display Embed Info    
ActiveTemplateType:                 CODE

Hi

Thanks all. Now it is working and I learn a lot from this post,

I attach my template, hope it will help those want to sort header and search on it.

(Please note that, It need manually input the instant in “TH:Headername”, “TH:DeepSearch” and “TH:SearchText”, in order to make it search on it. Due to I can not figure out, once put the template on the window )
Regards

Terry Ho
THABC.zip (4.8 KB)
Screenshot_2