Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetFldState and Alias not found troubles
Message
 
To
22/10/1997 07:57:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00055703
Message ID:
00056120
Views:
46
>> 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 <g>. 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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform