RAD Studio |  |

Calling Methods

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:

Copy Code

    DrawGrid1.Repaint;

Copy Code

    DrawGrid1->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:

Copy Code

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Repaint;
    end;

Copy Code

    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    Repaint;
    }

For more information about scope, see Scope and Qualifiers.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!