` Printed Icetips Article

Icetips Article



Par2: Edit in Place template to add REQ, UPR, Cap and range attributes
1999-08-13 -- Dennis Evans
 
The template, see below, will add the tool tip, req, cap, upr
and high low range limits (spin controls) to the fields on a browse.

One note, the copy below has 3 AT statements.  So it will only
add the attributes for three fields, to add more fields copy the
AT statements and change the constant value from 1, 2, 3 to 4, ...x

The one I use has 15, I seldom if ever have a browse with that many
EIP fields.

Maybe someone can find a way to accomplish the task with one at statement.
The only way I found to use one AT was to add a code template to each embed
for each field,  a bigger PITA than having
one template with several at commands.   I wanted to add one template
and let it handle all the fields.  Anyway, this is the only way I could
get it to work, not very pretty but it does function.

usage:

Register normally,
add the fields you want to set the attributes on to the Column specific
add the template to the UpdateBrowseButtons

There are no prompts for the template, it loops through the list of fields
added in the Column Specific list and then pulls the info from the
dictionary.

Hope it helps

        Dennis
        Can you "Carry the message to Garcia?"

#Template(EIPAttributes, 'Add Dictionary Attributes to EIP'),family('ABC')
#!
#extension(EipAttr, 'Add the CAP, REQ, UPR, TIP attributes to EIP
Fields'),REQ(BrowseUpdateButtons(ABC))
#atstart
#declare(%Temp, string)
#declare(%Holder, string)
#declare(%FieldsToAddAttr, string),multi
  #for(%EditInPlaceList)
    #add(%FieldsToAddAttr, %EditInPlaceField)
  #endfor
#endat
#at(%EditInPlaceManagerMethodCodeSection,%ActiveTemplateParentInstance,
1,'CreateControl','()')
  #insert(%AddAttributes)
#endat
#at(%EditInPlaceManagerMethodCodeSection,%ActiveTemplateParentInstance,
2,'CreateControl','()')
  #insert(%AddAttributes)
#endat
#at(%EditInPlaceManagerMethodCodeSection,%ActiveTemplateParentInstance,
3,'CreateControl','()')
  #insert(%AddAttributes)
#endat
#! -------------------------------------------------------------------------
---------------
#group(%AddAttributes),auto
#! loop thru the fields added and test for a match
#for(%FieldsToAddAttr)
#set(%Holder, %FieldsToAddAttr)
#if(%Holder = %EditInPlaceField)
   #find(%Field, %EditInPlaceField)
! set EIP field attributes ------------------------------
    #case(%FieldValidation)
      #of('NONZERO')                            #! does nothing in EIP, add
validation
Self.Feq{prop:req} = true
      #of ('INRANGE')                           #! if range set add limits,
for spin controls
        #if(%FieldRangeLow)                     #! is low end set
Self.Feq{prop:rangelow} = %FieldRangeLow
        #endif
        #if(%FieldRangehigh)                    #! is high end set
Self.Feq{prop:rangehigh} = %FieldRangeHigh
        #endif
    #endcase
    #for(%FieldScreenControl)
      #set(%temp, extract(%FieldScreenControl, 'CAP'))    #! cap present
      #if(%temp)
Self.Feq{prop:cap} = true
      #endif
     #set(%temp, extract(%FieldScreenControl, 'UPR'))    #! UPR present
     #if(%temp)
Self.Feq{prop:upr} = true
     #endif
     #set(%Temp, extract(%FieldScreenControl, 'TIP', 1))
     #if(%Temp)
Self.Feq{prop:tip} = %Temp
     #endif
    #endfor
! End EIP Attributes ------------------------------------
    #break
  #endif
#endfor



Printed May 3, 2024, 7:45 pm
This article has been viewed/printed 35121 times.