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?
CilicianAsked:
Who is Participating?
 
CilicianConnect With a Mentor Author 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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.