IDE Window: Code Templates/es

This is an old revision of IDE Window: Code Templates/es, edited by Iskraelectrica at . The current revision is 53488.

/* Ejemplo 1 - ifb */

¿Qué son las plantillas de código?

   Las platillas de código son texto con una abreviatura. Por ejemplo escribes 'cl' en el editor de código y después pulsas Ctrl+J para ver las plantillas que comienzan con 'cl'. Esta característica nos permitirá un gran ahorro de tiempo.

  Este diálogo permite editar las plantillas existentes o añadir tus propias plantillas.

  El texto puede contener macros. Y usted puede agregar sus propias macros mediante la creación de un paquete de tiempo de diseño y usando macrointf.pas del paquete IDEIntf.

Ejemplo 1 - ifb

Escribe <delphi> ifb|</delphi>

El sinbolo | representa el cursor. Pulsa Ctrl+j. El texto se expandirá a

<delphi> if | then begin

 end;</delphi>

Again the pipe represents the cursor. You can see the cursor has moved as well.

This template is called 'ifb' and is defined as follows: <delphi>if | then begin

end; </delphi>

This time the pipe '|' is a real character. It defines the cursor position after inserting the template.

Example 2 - Using macros

This example shows how to create a code template 'w' which inserts a line with the current procedure name.

 writeln(' ',|);
 writeln('$ProcedureName() ',|);

For instance:

 procedure TForm1.FormDestroy(Sender: TObject);
 begin
   w|
 end;

The pipe should represent here the blinking cursor, not a character.

 procedure TForm1.FormDestroy(Sender: TObject);
 begin
   writeln('TForm1.FormDestroy ',|);
 end;