Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetFldState and Alias not found troubles
Message
From
22/10/1997 16:01:04
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00055703
Message ID:
00056158
Views:
55
>>> 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
Map
View

Click here to load this message in the networking platform