[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 767
  • Last Modified:

OnActivate when form's parent is another form

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?
0
Cilician
Asked:
Cilician
  • 2
1 Solution
 
CilicianAuthor Commented:
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.
0
 
CilicianAuthor Commented:
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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now