Calling Methods

From RAD Studio
Jump to: navigation, search

Go Up to Working with Components Index

Methods are called just like ordinary procedures and functions. For example, visual controls have a Repaint method that refreshes the control's image on the screen. You could call the Repaint method in a draw-grid object like this:

DrawGrid1.Repaint;
DrawGrid->Repaint;

As with properties, the scope of a method name determines the need for qualifiers. If you want, for example, to repaint a form within an event handler of one of the form's child controls, you don't have to prepend the name of the form to the method call:

 procedure TForm1.Button1Click(Sender: TObject);
 begin
   Repaint;
 end;
void __fastcall TFrom1::Button1Click(TObject *Sender)
{   
   Repaint;
}

For more information about scope, see Scope and Qualifiers.

See Also