I have tested return both true and false with the same result. The problem is the wLogin window does not close and a TextField located on the same form executes the lostfocus event - which I do not want to happen. How can I make the wLogin window close and go away and the wMain window open.
The wMain window opens and loads Listboxes correctly but then a message box pops up from the wLogin window which says the UserID is invalid.
Background if it helps. I’m starting a new app that has a UserID and Access Level requirement. The wLogin is a pretty standard login that asks for UserID and Password and then compares them to stored values. I’m in the very early stages and want to skip having to enter a UserID and Password unless I am showing it to someone else who wants to see how it works. So I have a small label in a corner that has no significance to anything unless I click on it and then it just forces the login to the admin account. Just a short cut for testing.
With ShowModal, your code above waits for wMain to close before continuing. If you want to do it fluently, replace ShowModal by Show.
For the second issue, since wMain is showing, it’s expected any control in wLogin having the focus loses it (the whole window loses focus). You can’t prevent the event, as your TextField will always be activated once you show another window (and the event executes on purpose), but you can do tricks like this:
• Add a property to wLogin: ShouldDisregardFocusLosing as Boolean
• In your code above, add this: ShouldDisregardFocusLosing=true (before you show wMain, like at the first line).
• In the TextField’s LostFocus event add:
if ShouldDisregardFocusLosing then return 'Do not execute lines below if true.
//Your existing code here.