Difference between revisions of "As/es"

From Lazarus wiki
Jump to navigationJump to search
(Have been restored template which is present in English version (language bar + categories). Also deleted category because it is already included in template (for all languages).)
 
Line 7: Line 7:
 
Ejemplo:
 
Ejemplo:
  
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
procedure TmainForm.selectionGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
 
procedure TmainForm.selectionGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
 
begin
 
begin

Latest revision as of 02:26, 31 January 2020

Deutsch (de) English (en) español (es) suomi (fi) français (fr)

As

La palabra reservada As pertenece a la programación orientada a objetos y se utiliza para convertir (TypeCast) un objeto en una clase. Para ello, el objeto debe ser una instancia de la clase.

Ejemplo:

procedure TmainForm.selectionGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
     (Sender As TDBGrid).DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;

Aquí la variable Sender del tipo (type of) TObject se convierte/asigna como (as) tipo (type) TDBGrid.