Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Want to set the value of this.controlsource = this.value
Message
From
06/10/1998 17:23:01
Bruce Gilmour
Cal-Mour Consultants
Calgary, Alberta, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00144183
Message ID:
00144388
Views:
35
>doing a work around for validating from the cmdsave on the toolbar. because i call lastcontrol.valid myself, the controlsource is not updated with the value. want to update the controlsource with the value generically. do not want to change all my valid code, since it all references the controlsource now.
>
>do not want to actually update the controlsource, but the controlsource's value.
>
>controlsource = tablex.field1
>tablex.field1 = .t.
>
>want to set tablex.field1 = this.valuel
>
>any ideas?
>
>brenda


Brenda,
Don't know if this will help but I am including some code from the WriteBuffer method of the Tastrade example in their basform that seem to be what you are heading for (I Hope I read your problem right) HTH
LOCAL llRetval
llRetVal = .T.

*-- Code to save field value to buffer when
*-- clicking on toolbar without leaving the field
*-- Don't do this for a grid since a grid may change
*-- work areas unexpectedly

IF TYPE("thisform.ActiveControl") == "O" AND ;
    UPPER(thisform.ActiveControl.BaseClass) <> "GRID"
  IF TYPE("thisform.ActiveControl.ControlSource") <> "U" AND ;
      !EMPTY(thisform.ActiveControl.ControlSource) AND;
    	UPPER(SUBSTR(thisform.ActiveControl.ControlSource,1,AT(".",thisform.ActiveControl.ControlSource)-1)) <> "THISFORM"
    IF EVAL(thisform.ActiveControl.ControlSource) <> thisform.ActiveControl.Value
      REPLACE (thisform.ActiveControl.ControlSource) WITH thisform.ActiveControl.Value
      *-- We rely on the fact that we revert the field's value
      *-- in the error event method for the form. 
      llRetVal = (EVAL(thisform.ActiveControl.ControlSource) = thisform.ActiveControl.Value)
    ENDIF
  ENDIF
ENDIF

RETURN llRetVal
***************************
Bruce Gilmour

"Two things are infinite, the Universe and human stupidity. And I am not sure about the Universe."
- Albert Einstein
Previous
Reply
Map
View

Click here to load this message in the networking platform