General information
Category:
Coding, syntax & commands
>>> IF TYPE("_screen.activeform.ActiveControl.Name") = "C"
>>> _screen.activeform.ActiveControl.SetFocus()
>>> ENDIF
>
>>IF GETFLDSTATE(0) % 2 = 1 AND TYPE("THISFORM.ActiveControl") == "O" AND ;
>> UPPER(THISFORM.ActiveControl.BaseClass) "GRID"
>> IF TYPE("THISFORM.ActiveControl.ControlSource") "U" AND ;
>> !EMPTY(THISFORM.ActiveControl.ControlSource)
>> IF EVAL(THISFORM.ActiveControl.ControlSource) THISFORM.ActiveControl.Value
>> REPLACE (THISFORM.ActiveControl.ControlSource) WITH THISFORM.ActiveControl.Value
>> IF ALLTRIM(EVAL(THISFORM.ActiveControl.ControlSource)) = ALLTRIM(THISFORM.ActiveControl.Value)
>> llRetVal = .T.
>> ELSE
>> llRetVal = .F.
>> ENDIF
>> ENDIF
>> ENDIF
>>ENDIF
>
>Marcia,
>
>Three lines of code versus 12 lines . Also TYPE("Blah") = "O" is not a full check for an object, the var may be type O and be value NULL, in this case you other checks would error. This is why I check TYPE("Blah.Name") = "C", because Blah may be type O and value is NULL but Blah.Name will only be type C if the object exists. Also your code will do a replace on the field, but the control will also update the field again when it loses focus. GetFldState will become dirty even if you replace the field with the same value it already has.
>
>As for the THIS.Value = File.Field, that line dirties the buffer.
Hi Jim.
Thanks for the info on TYPE("blah"). Now I can fix my code *before* I waste 2 days trying to solve a problem that *should* have been obvious the minute I saw it. As for this.value = file.field, I should have realized from the start that this was my problem. It was one of those times when I should have walked away from the problem, worked on something else, and come back to it so I could see what was in front of my nose! It sure is a humbling experience (every time it happens to me!)
Best Regards.
Marcia
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only