Alert p/o programmer when opening Form (Designer)

Asked

Viewed 205 times

4

When a programmer opens a specific form, I would like to send a notification (ShowMessage()) even for it to pay attention, for example, to the comments that are in the file header .pas in question.
I’ve seen it on another company project, but I don’t know how to do it.

Anyway, how to do?

  • When it opens the . pas file in Delphi or when to open the program in the application ?

  • @Victorzanella When open the .pas. I want you to alert in designer, not in Runtime.

  • There’s a gringo stack post, which they quote PaletteCreated. I don’t know if this guy is right for you, because he only warns when you create a palette component in Form. If this fits you, I can give you the prototype I made. Meanwhile I’ll try to find another way to show the msg. Link: http://stackoverflow.com/questions/33926320/display-a-warning-when-dropping-a-component-on-a-form-at-designtime

  • @Victorzanella I had already seen this post on Soen, but it’s not really what I want... the idea is this, but when accessing a form to develop and not when dragging a new component. Thank you.

  • That’s what I thought. Interesting feature. I’ll keep looking for something ;)

  • @Victorzanella Take a look at it question that I did in the Soen, my English disturbs (too)... but comments can be interesting.

  • It seems to me, would have to do, but would have to be written a plugin for Delphi.

Show 2 more comments

2 answers

1

In the "Father" Form Keydown try 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 the form is open, you must press the buttons on the keyboard Crtl + Alt + Shift + F12. It will send the form name as a message to assist you in developing.

  • TDelphiUtil?? What library is this? I do not know and even after searching the web I found nothing...

  • Sorry, use Debughook <> 0 instead of Tdelphiutil.isRunningUnderDelphi (I just got an example from my project.) link

  • Cool your code, I already have a similar routine in the application that reaches the same result. But what I want according to the question is something else... I want when opening the form in development mode (no Runtime), a showmessage (or similar) for the developer to know of some precautions to be taken in the development of the screen.

  • I even searched the ends of the earth at that time something similar you want kkk but I did not find, you said you saw it in a project of another company, but I do not know, do you remember if it can be component of third? Type Cnpack?

  • 1

    I do not remember, long ago... but I do not doubt. I also searched a lot and at most, I saw that it is possible by means of a plugin as mentioned in the question http://stackoverflow.com/q/41060313/6840825

  • Probably you have to use it this way then my friend, because native Delphi I believe you will not have what you are looking for.

Show 1 more comment

1

Use a build directive on OnCreate 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;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.