OnActivate when form's parent is another form

Posted on 2008-11-14
Last Modified: 2012-05-05
I have dll forms that are opened within a main form in a right panel.  The dll forms parent is set to the main form's right panel. The dll's form's parent TWinControl is transferred to the main form via a parameter in the exporting procedure. I want to connect to a database and load data in the dll forms FormActivate, but when the dll is opened its FormActivate is never triggered. I tried forcing FormActivate in the dll's exporting prodecure right after showing the form by adding: SendMessage(DLLFormName.handle, WM_ACTIVATE, WA_ACTIVE,0); but this gave me an error "Cannot focus a disabled or invisible window". Is there no way to still access the dll form's onactivate when the form's parent is another form?
Question by:Cilician

    Author Comment

    Setting the form's ActiveControl property to anything on the form gets rid of the "Cannot focus a disabled or invisible window".  but the form's OnActivate is still not triggered.

    Accepted Solution

    Well I found a solution. OnActivate was triggered when I called it from OnShow with DLLFormName.OnActivate(Sender); Beats me as to why OnActivate isn't triggered otherwise.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now