Odd problem..... Thought that this approach was the answer, but after updating my little app with this logic. Well all works fine until there are 2 blank fields in a row. Upon leaving first blank field I get my "can't have a blank field" msg, I will continually get this message and a message for the next blank field as well. Even though I have NOT gotten that far yet. It continues to popup the message for both fields. If I have 3 blank fields in a row, it still only pops up the error message for the current field and the next, back and forth, back and forth. For the most part I have not really changed the core of the function, but here it is for review: Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
Switch $lParam
Case $hFirstName, $hMiddleName, $hLastName, $hjob, $hssn, $hStartWork
Local $iHi = _WinAPI_HiWord($wParam)
Local $iLo = _WinAPI_LoWord($wParam)
Case Else
Return $GUI_RUNDEFMSG
EndSwitch
if $iHi = $OnEntry Then Return $GUI_RUNDEFMSG ; ignore all OnEntry msgs
if $iHi = $OnLeave Then
Switch $iLo
Case $job, $FirstName, $MiddleName, $LastName, $ssn, $StartWork
if GUICtrlRead($iLo) = "" Then ; generic logic for blank required fields
msgbox(0,"Error","Mandatory field, entry required." )
GUICtrlSetState($iLo, $GUI_FOCUS) ; return focus back to field just left
return 0
EndIf
EndSwitch
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND What I don't understand.... is it seems that the focus actually gets set to the next field for some reason. Even though my logic fires the check for a blank field, pops up the error message and then attempts to set focus back to the blank field for the user to actually enter something. How to prevent focus on the next field when I need the user to stay within the current field? I believe the answer to this question should solve this hiccup. I'm primarily a UNIX programmer for the last 20+ years and the Windows relm is quite a different beast then what I'm use to. I know it's probably something simple, just giving some insight why it's not obvious to me.