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;
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:
procedure TForm1.Button1Click(Sender: TObject); begin Repaint; end;
void __fastcall TForm1::Button1Click(TObject *Sender) { Repaint; }
For more information about scope, see Scope and Qualifiers.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|