I have looked at all of the "Standard" events and played with a few custom event messages trying to find how to detect each time a form becomes active. I can't seem to find it.
Paint does not work since lots of things make the form repaint. I just need to detect ONCE when the form becomes the active form.
This is a form on a tab control. Does that make a difference?
Thanks
If you need to know which child form in the Tab Control is active then I would respond to the TCN_SELCHANGE notification. You should know which Forms belong to which tab page. If you don't, then you can get it from the lParam of the current tab control page.
Function FRMMAINFORM_TABCONTROL1_TCN_SELCHANGE ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
ByVal lpNMHDR As NMHDR Ptr _ ' pointer to NMHDR
) As Long
CurTab& = TabCtrl_GetCurSel(HWND_FRMMAINFORM_TABCONTROL1)
'MsgBox "Current Tab is:" & Str$(CurTab&)
'FireFly saves the child Form's window handle in the lParam of the TabControl.
TCITEM.Mask = %TCIF_PARAM 'get the dialog's window
TabCtrl_GetItem hWndControl, CurTab&, TCITEM
'MsgBox "Current child Form is:" & str$(TCITEM.lParam)
End Function
This tab stuff gives your brain a work out when you have multi-level tabed forms (tab forms with tab form on them).
I used the TCN_SELCHANGE event on each form and that now works. Since I know which child form belongs to each tab standard FF functions can tell me the selected tab on that control.
Although not needed right now the dotted structure in the code provided by Paul is not valid in this context. Not being an SDK guru what am I missing?
'FireFly saves the child Form's window handle in the lParam of the TabControl.
TCITEM.Mask = %TCIF_PARAM 'get the dialog's window
Thanks for the help.