Alert to programmer when opening Form (Designer)

4

When a programmer opens a specific form, I would like to send a notification ( ShowMessage() ) to it, for example, to the comments that are in the header of the% . I've seen this in a project from another company, but I do not know how to do it.

Anyway, how to do it?

    
asked by anonymous 08.12.2016 / 18:43

2 answers

1

Use a build directive in the OnCreate of form:

Interface 
{$I YourInc.inc}

Form.Create(Sender:TObject);
Begin
{$IFDEF DESIGNTIME}
showmessage('alguma coisa');
{$ELSE}
// o código normal em tempo de execucao.
{$ENDIF}
end;
    
12.12.2016 / 10:49
1

In the KeyDown Form "Father" attempts to apply this.

if (( Shift = [ ssctrl, ssalt, ssshift ] ) and ( Key = VK_F12 )) and
    (DebugHook <> 0) then
  begin
    ShowMessage(Self.UnitName);
    Clipboard.AsText := Self.UnitName;
  end;

With this, when you have the form open, you must press the keyboard buttons Crtl + Alt + Shift + F12. It will send the form name as a message to assist you in the development.

    
20.03.2018 / 20:52