` Printed Icetips Article

Icetips Article



Templates: What is needed for ABC to generate method call embeds
2003-06-13 -- Ole-morten Heien
 
Newsgroups: TopSpeed.Topic.Templates

Editors note:  Please note that some lines may wrap in the template code.

Hi.
Allmost all my classes has a template wrapper and i dont have problems with
this.  I have added some changes to your code that represent the way i do it
Hope this help.

>
> #EXTENSION(MyExtension,'Explanation'), PROCEDURE
> #PREPARE
>   #CALL(%ReadABCFiles(ABC))
>   #CALL(%SetClassDefaults(ABC), 'Default', 'Resizer', 'MyClass')

#CALL(%SetClassDefaults(ABC),'ClassName','ObjectName' &
%ActiveTemplateInstance,'ClassName')
 I dont remember why i use ClassName tvice

>   #CALL(%SynchronizeOverrides(ABC))
This CALL i dont use.  Why are you?

> #ENDPREPARE
>   #BOXED('Default Resizer prompts'),AT(0,0),WHERE(%False),HIDE
>     #INSERT(%OOPHiddenPrompts)

#Insert(%OOPHiddenPrompts(ABC))

>   #ENDBOXED
>   #SHEET
>     #TAB('Classes')
>       #WITH(%ClassItem,'Default')

#With(%ClassItem,'ClassName')

>         #INSERT(%ClassPrompts(ABC))
>       #ENDWITH
>     #ENDTAB
>   #ENDSHEET
> #!
> #ATSTART
>   #CALL(%ReadABCFiles(ABC))
>   #CALL(%SetClassDefaults(ABC), 'Default', 'Resizer', 'MyClass')

#Call(%SetClassDefaults(ABC),'ClassName',ObjectName' &
%ActiveTemplateInstance,'ClassName')
Again i dont remember why i use classname tvice

>   #EQUATE(%ResizerObjectName,%ThisObjectName)

THis EQUATE i dont use
#Declare(%ThisControl)
#Call(%GetControlName(ABC)),%ThisControl    ! My template is for controls

> #ENDAT
> #!
> #AT(%GatherObjects)
> #CALL(%AddObjectList(ABC), 'Default')

#Call(%AddObjectList(ABC),'ClassName')
#Call(%SetClassItem(ABC),'ClassName')

> #ENDAT
>
>
And some other #AT's of mine that i use
#At(%LocalProcedures)
    #Call(%GenerateVirtuals(ABC),'ClassName','Local Objects|ABC Objects|' &
%ThisControl & ' - Some
descriptions','%GenerateVirtuals(YourTemplateChain)',%True)
#Endat
#At(ClassNameMethodCodeSection,%ActiveTemplateInstance),PRIORITY(5000),DESCR
IPTION('Parent Call'),WHERE(%ParentCallValid())
    #Call(%GenerateParentCall(ABC))
#EndAt
'ClassNameMethodCodeSection '  Here the CLassName is your className.  This
is like WindowManagerMethodCodeSection

Next i add some groups
#GROUP(%GenerateVirtuals,%TreeText,%DataText,%CodeText)
#Embed(%ClassNameMethodDataSection,'Any
description'),%ActiveTemplateInstance,%pClassMethod,%pClassMethodPrototype,L
ABEL,DATA,Prepare(,%FixClassName(%FixBaseClassToUse('ClassName'))),TREE(%Tre
eText & %DataText)
#?%NULL
    #?CODE
    #Embed(%ClassNameMethodCodeSection,'Any
description'),%ActiveTemplateInstance,%pClassMethod,%pClassMethodPrototype,P
REPARE(,%FixClassName(%FixBaseClassToUse('ClassName'))),TREE(%TreeText &
%CodeText)

#GROUP(%BaseClassToUse)
    #if(%UseDefaultABCBaseClass)
        #if(%ActualDefaultBaseCLassType)
            #Return(%ActualDefaultBaseClassType)
        #Else
            #Assert(%DefaultBaseCLassType,'%BaseClassToUse: Symbol
%DefaultBaseClassType is being returned empty [' & %ClassItem & ']')
            #Return(%DefaultBaseClassType)
        #EndIf
    #ElsIf(%UseABCBaseClass)
        #Return(%ABCBaseClass)
    #Elsif(~%UseABCBaseClass)
        #Return(%ExtBaseClass)
    #EndIf
    #Assert(%False,'%BaseClassToUse: IF clauses all missed')

#GROUP(%GetBaseClassType)
    #Assert(%ClassItem,'%GetBaseCLassType: ClassItem has no instance')
    #Return(%BaseClassToUse())

#Group(%MethodEmbedPointValid()
    #if(Upper(%pClassName) = UPPER(%BaseClassToUse()) AND
~%pClassMethodPrivate
        #Return(%True)
    #EndIf
    #Return(%False)

#Group(%FixClassName,%ToUse)
    #Assert(%ToUse,'%FixClassName: ToUse parameter empty')
    #Call(%ReadABCFiles(ABC))
    #Call(%NoCaseFix(ABC),%pClassName,%ToUse)
    #Assert(Upper(%pClassName) = upper((%ToUse),'%FixClassName: Cannot find
class 'ยจ& %ToUse)

#Group(%FixBaseClassToUse,%FixTo)
    #Assert(%FixTo,'%FixBaseClassToUse: FixTo parameter empty ' & %FixTo)
    #Call(%SetClassItem(ABC),%FixTo)
    #Return(%BaseClassToUse)

#Group(%ParentCallValid)
    #If(Upper(%pClassMethod) = 'CONSTRUCT' or upper(%pClassMethod) =
'DESTRUCT' or %pClassMethod = '')
        #Return(%False)
    #EndIf
    #Return(%True)

Thats about it i guess :-)  BTW - I found out about this by looking at  SoftMasters Office
Template



--
Ole-Morten Heien
HD Software
www.hdsoftware.no
Mail: o-m|__Spammers_Not_Welcome_here_|heien@hdsoftware.no
ICQ: 72785878
MSN: spam@hdsoftware.no



Printed November 21, 2024, 6:41 am
This article has been viewed/printed 35224 times.
Google search has resulted in 59 hits on this article since January 25, 2004.