An application I am working on will require a log on to authenticate the user BEFORE DISPLAYING the main interaction form. Conceptually I thought... Make the log on form the start-up form and then have it call the main interaction form. This fails. It appears that as soon as I exit the start-up form the whole app exits. Am I missing something?
If not, then I see three options to handle this...
- Leave things as is, but HIDE the log on form rather then exit it. Only send it an exit when the main form exits
- use a non-visible "dummy" form as the start-up form to coordinate all other forms
- have the main form be the start-up form, start it hidden, and have it call log on. Once logon authenticates the user then unhide the main form
Did I miss another method? What would others do?
I used your first method. Put a post message in the main form create section and then did the hide in the custom section.
I originally tried your 3rd method, but my main form has numerous tabs and child forms. Method 1 provided a faster display of an initial form for the user.
Function FRMTBMAIN_WM_CREATE (...
...some code
PostMessage hWndForm, %WM_FORM_CREATE_COMPLETE, 0, 0
END FUNCTION
Function FRMTBMAIN_CUSTOM (...
Select Case %WMSG
Case %WM_FORM_CREATE_COMPLETE
FF_Control_ShowState(HWND_FRMLOGON, %SW_HIDE )
END FUNCTION
Create complete is a user equate - %WM_FORM_CREATE_COMPLETE = %WM_USER + 1000
I use #3 - I start the main form and display a login form. The user has the option to use a proper login (user name and password) or exit the application.
Rolf
I remember this type of scenario being discussed several times in this forum over the years. I would tend towards option #3.