Delphi/CB
•  Greatis •  Security •  AppDatabase •  Utilities •  Visual Basic • .NET •  just4fun
Delphi / C++ Builder
Components, utilities and tips for Delphi and C++ Builder developers
More info
Form Designer FAQ
Form Designer Home
Delphi Components
See also
Products
Object Inspector
Runtime Fusion
Print Suite
Commented Image
Image Editor  new!
Delphi Toys
Ultimate Pack  hot!

FAQs
Object Inspector FAQ
Print Suite FAQ
Image Editor FAQ

Links
Software for .NET
Software for VB 6
Delphi Tips & Tricks

Services
Outsourcing
Processing the events in the application
When TFormDesigner is active it processes all messages of the form and controls itself and standard events of the form and controls are not fired. If you want to process some events in your application without deactivating TFormDesigner just lock it by the Lock procedure. After it all messages will be sent to the OnMessage event and can be processed by your code. The code below allows to choose a point to placing the new label on the form. The form contains the protected AddNewLabel button.
procedure TForm1.AddNewLabelClick(Sender: TObject);
begin
  // locking the designer
  FormDesigner1.Lock;
end;

procedure TForm1.FormDesigner1Message(Sender: TObject; var Msg: TMsg);
begin
  // processing the message
  with Msg do
    // if message is mouse down and user clicks the form...
    if (Message=WM_LBUTTONDOWN) and (hwnd=Handle) then
    begin
      // ...we create the new label...
      with TLabel.Create(Self) do
      begin
        Left:=LoWord(lParam);
        Top:=HiWord(lParam);
        Caption:='New label';
        Parent:=Self;
      end;
      // ...and unlock the designer
      FormDesigner1.Unlock;
    end;
end;
Note that the passed message has a Windows message format (see TMsg in Delphi and MSG in WinAPI).

Greatis Software Greatis | Security | AppDatabase | Utilities | Delphi/CB | Visual Basic | .NET | just4fun

Contacts | Add to Favorites | Recommend to a Friend | Privacy Policy | Copyright © 1998-2008 Greatis Software