Foc001 #Focus U-Turn Test Program (Revised) wwwwp wwwwwp Form1+ lblNumericOnly Numeric-Only lblAlphaOnly Alphabetic-Only lblLeftRight Left / Right lblValue Value txtNumericOnly txtAlphaOnly hsbLeftRight lblLRValue lblOptions Options: lblCategories Categories: lblType Type: rbtOptions rbtOptions cbxChkBox cbxChkBox clbType rbtOptions rbtOptions cbxChkBox cbxChkBox lblComments1 When ALL control edits are passed, this form can be unloaded or exited. ALL controls, except option buttons and push buttons, are initialized to values that will fail verification. This is done to require input of valid values. pbtLoadFocusUTurn " Unload FOCUS-U-TURN Form . . . lblComments2 The 'Unload...' push button transfers to a second form that allows this form to be reloaded. The 'Verify and Exit' push button will NOT allow an exit unless ALL edits are passed. pbtExit Verify and Exit pbtExitNoVerify Exit Without Verify Text1_Change Form_Click Form_Load nVerifyOK txtFirstName_Change# txtFirstName_GotFocus hgCtlWithFocus GetFocus ngVerifyOKE txtLastName_Change hsbLeftRight_Change txtFirstName_LostFocus\ txtFirstNameE Textg nRetValh PostMessage WM_NEXTDLGCTL lParam txtLastName_GotFocus+ hsbLeftRight_GotFocus SendMessage FALSE ngCtlFocusIDk txtLastName hsbLeftRightq txtLastName_LostFocusN hsbLeftRight_LostFocusk Value nCurrValue ngCurrValue2 nTypeK Verifyn pbtExit_ClickW SelStart SelLength clbType_Change clbType_GotFocus\ clbType clbType_LostFocus csbType0 ListIndex ngCurrIndex nVerifyAll lblType_Click FocusUTurn/ Foc001 pbtLoadFocusUTurn_Clickz Foc002u lblLeftRightValue? Caption Command1_Click% pbtExitNoVerify_Click nMsgOnOff@ nMsgOn pbtExit_GotFocus pbtLoadFocusUTurn_GotFocus Label1_Clicks ngCurrDirectionValue& ngIgnoreClick ngNumberOfCtls rbtDirection_Click Index szMsg rbtDirection rbtDirection_GotFocus@ rbtDirection_LostFocus AllDone\ ByeBye AstaLaVistaBayBee rbtDirection1_Clicku rbtDirection_GotFocus2Z rbtDirection1_GotFocus rbtDirection1_LostFocus9 rbtDirection2 ElsenMsgOn rbtDirection2_Click rbtDirection2_GotFocus rbtDirection2_LostFocusr rbtDirection1 rbtDirection1_DblClick rbtDirection1_DragDrop4 SourceR rbtDirection1_DragOver State rbtDirection1_KeyDown KeyCode% Shift6 rbtDirection1_KeyPress KeyAscii rbtDirection1_KeyUp szStr rbtDirection2_DblClickP rbtDirection2_DragDrop rbtDirection2_DragOverW rbtDirection2_KeyDown rbtDirection2_KeyPress rbtDirection2_KeyUp} RemszMsg ngSaveRadioButtonValue rbtOptions rbtOptions_GotFocus rbtOptions_LostFocus ngSaveHScrollValue ngSaveListIndex= ngSaveOptValues ngSaveLRValue lblLRValue Enabled ngSaveOpt ngSaveOpts clbType_Click cbxC1_Click cbxC1_GotFocus cbxC1 ngSaveC1Value cbxC1_LostFocus cbxC1_DragDrop cbxC1_KeyUp ValuengSaveOptValuesi UNCHECKED ngSaveC1ValuesG ngSaveChkBoxValues. cbxChkBox_GotFocus cbxChkBox_LostFocuse cbxChkBox InitOptsAndChkBoxes txtNumericOnly_GotFocus txtNumericOnly_LostFocus txtAlphaOnly_Change txtAlphaOnly_GotFocus txtAlphaOnly_LostFocus txtNumericOnly txtAlphaOnly' txtNumericOnly_KeyPress txtAlphaOnly_KeyPress ValidateForm VerifyForm nSwitchId clbType_KeyDown5 SkipIt WhyNotSkipIt nCtlID ngCtlID nDoNotSetFocus nSetFocus ngOptsAndChkBoxesJustReset cbxChkBox_Click& ngNumberOfCtlsStep MSG_WARNING szTitle StupidFunctiond ChkBoxGotFocus ChkBoxLostFocus2 Form_Load ngSaveListIndex = 99t (A1 xor A2) and (C1 or C2) (B1 xor B2) and (D1 or D2) (A1 xor B1) and (C1 or D1) (A2 xor B2) and (C2 or D2) hsbLeftRight_GotFocus This is where we 'think' we are...so all is well... hsbLeftRight_LostFocus Do NOTHING...let GotFocus handle 'Focus U-Turns'... hsbLeftRight_Change Verify OK...so ignore this... hsbLeftRight is current control...so do nothing...t pbtExit_Click szMsg$ = "pbtExit_Click: ngCtlFocusID = " + LTrim$(RTrim$(Str$(ngCtlFocusID)))C MsgBox szMsg$ Do NOTHING...not interested since no problem... clbType_GotFocus szMsg$ = "GotFocus: ListIndex = " + LTrim$(RTrim$(Str$(clbType.ListIndex))) szMsg$ = szMsg$ + LTrim$(RTrim$(Str$(ngSaveListIndex)))c MsgBox szMsg$$ This is where we 'think' we are...so all is well... clbType_LostFocus szMsg$ = "clbType_LostFocus: ngCtlFocusID = " + LTrim$(RTrim$(Str$(ngCtlFocusID))) MsgBox szMsg$T Do NOTHING...Let GotFocus handle 'Focus U-Turns'... pbtLoadFocusUTurn_Click szMsg$ = "pbtLoadFocusUTurn_Click: ngCtlFocusID = " + LTrim$(RTrim$(Str$(ngCtlFocusID))) MsgBox szMsg$ Do NOTHING...not interested since no problem... pbtExitNoVerify_Click pbtExit_GotFocus All of the events are coded to stop on the FIRST edit error...If it isi important to see ALL edit errors then another function similar to FocusUTurn() can be used...However, it is more complicated because it requires that you KNOW how many errors so that you can actually do theo 'Focus U-Turn' on the last one in addition to displaying the message... Alternatively, you could build a list of all errors, load-up a listboxs with the error list and then do the 'Focus U-Turn' via a 'OK' push button on a modal form... Current control is OK...so continue checking the other controls...z Do NOTHING...not interested since no problem... Already did this one... No need to do anything more at this point.... pbtLoadFocusUTurn_GotFocus szMsg$ = "pbtLoadFocusUTurn_GotFocus: ngCtlFocusID = " + LTrim$(RTrim$(Str$(ngCtlFocusID))) MsgBox szMsg$ Current control is OK...so continue checking the other controls...z Do NOTHING...not interested since no problem... Already did this one... No need to do anything at this point... rbtOptions_GotFocus szMsg$ = "GotFocus: Index = " + LTrim$(RTrim$(Str$(Index))) MsgBox szMsg$ rbtOptions_LostFocus szMsg$ = "LostFocus: Index = " + LTrim$(RTrim$(Str$(Index))) szMsg$ = szMsg$ + " ngCtlFocusID = " + LTrim$(RTrim$(Str$(ngCtlFocusID))) MsgBox szMsg$ Do NOTHING...let GotFocus handle 'Focus U-Turns'... clbType_Click szMsg$ = "Click: ListIndex = " + LTrim$(RTrim$(Str$(clbType.ListIndex))) MsgBox szMsg$$ cbxChkBox_GotFocus cbxChkBox_LostFocus txtNumericOnly_GotFocus This is where we 'think' we are...so all is well... txtNumericOnly_LostFocus Do NOTHING...let GotFocus handle 'Focus U-Turns'... txtAlphaOnly_GotFocus szMsg$ = "txtAlphaOnly_GotFocus: ngCtlFocusID = " + LTrim$(RTrim$(Str$(ngCtlFocusID))) MsgBox szMsg$ This is where we 'think' we are...so all is well... txtAlphaOnly_LostFocus Do NOTHING...let GotFocus handle 'Focus U-Turns'... txtNumericOnly_KeyPress txtAlphaOnly_KeyPress szMsg$ = "txtAlphaOnly_KeyPress: KeyAscii = " + LTrim$(RTrim$(Str$(KeyAscii)))C MsgBox szMsg$