` Printed Icetips Article

Icetips Article



Par2: Template modification to change "Ok" to "Delete" when called to delete
1999-03-26 -- Arnor Baldvinsson
 
When a form is called to confirm the delete and you wish to change the text of the Ok
button, you can:

(SHP)
>If ThisWindow.Request = DeleteRecord
> ?DeleteButton{Prop:Text} = ....
>Really, really like it? Put it in your default registry.

or you can modify the templates:
Between lines 142 and 143 in abupdate.tpw:

If Self.Request = DeleteRecord              !! AB 27-03-1999
  ?OK {Prop:Text} = 'Delete'                !! AB 27-03-1999
End                                         !! AB 27-03-1999

Then it should look like:

#AT(%WindowManagerMethodCodeSection,'Init','(),BYTE'),PRIORITY(8500)
  #FOR(%Control)
    #IF(UPPER(EXTRACT(%ControlStatement,'STD',1))='STD:HELP')
ToolBarForm.HelpButton=%Control
      #BREAK
    #ENDIF
  #ENDFOR
If Self.Request = DeleteRecord              !! AB 27-03-1999
  ?OK {Prop:Text} = 'Delete'                !! AB 27-03-1999
End                                         !! AB 27-03-1999
SELF.AddItem(ToolbarForm)
#ENDAT

Seems to work - use at own risk;)

Amended 27 March:

Personally I'd rather put it in an extension template.  Something
like:

#TEMPLATE(ABCExtensions,'My ABC extion stuff'),FAMILY(ABC)
#EXTENSION(ABCSetDeleteButtonOnForms,'Replace text on Delete button')
#AT(%WindowManagerMethodCodeSection,'Init','(),BYTE'),PRIORITY(8500)
If Self.Request = DeleteRecord              !! AB 27-03-1999
  ?OK {Prop:Text} = 'Delete'                !! AB 27-03-1999
End                                         !! AB 27-03-1999
#ENDAT

Then you don't have to remember to modify TS templates when they
release a new patch which updates the template chain.  

Fernando Cerini adds:
>  ?OK {Prop:Text} = 'Delete'                !! AB 27-03-1999

Is better:
    SELF.OkControl{Prop:Text} = 'Delete'



Printed November 21, 2024, 12:19 pm
This article has been viewed/printed 35200 times.