Question: Some of my forms can be shown both as normal and modal forms.
In case they're showing as modal forms, I have to hide some components which are not usefull in modal state.

```
if(fsModal in Self.FormState) then
begin 
  //hiding some components...
end;

```

I would like to execute my code before the form is drawn, in order to avoid it's drawn more times unnecessarily.

Answer: 
I thought that OnShow executed before the form is visible, but it seems that is not so. So you can do this:

```
TMyForm = class( TForm )  // this will already be in your source
public
  function ShowModal: Integer; override;
end;

function TMyForm.ShowModal: Integer;
begin
  // hide some components
  Result := inherited;
  // show them again in case next time it is a Show
end;

```

You can't override Show in the same way - you would have to override the visible property, so easier to reset the visibility of the components as shown.
You can write some initial procedure for two type of showing:

```
(in Form)
procedure TfrmForm01.Init(p_Modal: Boolean);
begin
  if p_Modal then
    begin
      edtForModalForm.Visible := False;  // hide some components
      ShowModal;
    end
  else
    Show;
end;

```

and you can call form by parameter. True for Modal, False for NoModal form:

```
(In main program)
procedure TForm1.btnShowFormClick(Sender: TObject);
var
  v_F : TfrmForm01;
begin
  v_F := TfrmForm01.Create(self);
  v_F.Init(True);
end;

procedure TForm1.btnShowModalFormClick(Sender: TObject);
var
  v_F : TfrmForm01;
begin
  v_F := TfrmForm01.Create(self);
  v_F.Init(False);
end;

```

I wrote and tested this example in Delphi7.