Not sure if I'm missing something or what, but when I use the FormName_SHOW function to show a non-modal window it makes my main window lose its tab order. All I have right now is a skeleton app and when a button is clicked I call the SHOW function for my other form and correctly set the parent and set modal to %FALSE. When I go back to my main form and click a control then hit tab the cursor/focus box disappears and when I press Tab again it just beeps.
I've looked at the generated code and can't find anything wrong. What I really want to do is set the parent to the desktop so clicking my window doesn't just activate it and leave the second on top, but I can't seem to get the tab order to work either way??? In the generated code it looks like it doesn't activate/change focus/disable the parent, etc unless it is modal so shouldn't be making any problems. Do I need to activate and change focus to the 2nd form when the button is clicked then back to the main form in the 2nd's destroy/close or what???
I think I found the problem now...gFF_hDlg is a global that stores the current form for tab order and cursor movement. It is only set when the window is shown or hidden...may need to be set in WM_ACTIVATE or something. Also should probably be STATIC maybe to the form and only in the message handler that uses it to eliminate the problem all together?
My temporary fix so far until FF is patched is:
Function FORMNAME_CUSTOM (hWndForm As Dword, wMsg As Long, wParam As Dword, lParam As Long) As Long
Select Case wMsg
Case %WM_ACTIVATE
If LoWrd(wParam) <> %WA_INACTIVE Then gFF_hDlg= HWND_FORMNAME
End Select
End Function
Why does the Global value need to be used anyway? Wouldn't the hWnd in the callback be the form the focus is currently in, so just use it. Or it looks like the callback it is in is for the control, so you'd need to get parent or something...
Hi Roger,
I have added your code to the Select Case of the Form Procedure.
If I remember correctly, that variable is very important in situations where you use a Tab Control and the Forms are children of the Tab Control.
Yeah, the control should still be on a form though and getting the parent should work in the call for getting the next/previous control in the TAB key and arrow key handler, but I guess this is ok for now.
might want to modify the code too if you haven't to be:
Function FORMNAME_CUSTOM (hWndForm As Dword, wMsg As Long, wParam As Dword, lParam As Long) As Long
Select Case wMsg
Case %WM_ACTIVATE
If LoWrd(wParam) <> %WA_INACTIVE Then gFF_hDlg= hWndForm
End Select
End Function
Since the HWND variables have a small flaw where when the form is created twice it equals the 2nd or 3rd if three times, etc...this would create a problem if on activation of the 1st form it is set to the HWND variable which is now equal to the handle of the 2nd form created.