RAD Studio
ContentsIndex
PreviousUpNext
Adding the Execute Method

The final part of the component interface is a way to open the dialog box and return a result when it closes. As with the common dialog box components, you use a boolean function called Execute that returns True if the user clicks OK, or False if the user cancels the dialog box. 

The declaration for the Execute method always looks like this:

type
  TMyWrapper = class(TComponent)
  public
    function Execute: Boolean;
  end;

 

class PACKAGE TMyWrapper : public TComponent
{
  .
  .
  .
public:
    bool __fastcall Execute();
  .
  .
  .
};

The minimum implementation for Execute needs to construct the dialog box form, show it as a modal dialog box, and return either True or False, depending on the return value from ShowModal.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!