Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checkbox reacts to Y/N field
Message
From
29/01/2007 17:10:58
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01189996
Message ID:
01190310
Views:
12
- Now, as it's the source of data to which an object is bound, how would this func. tell the form that data input here goes in to my table field?

It wouldn't. When you use an expression of this sort as the ControlSource of a grid column, the column becomes ReadOnly.

If you want a checkbox class that you can bind to a Y/N value, here is one but I have never used it in a grid:
**************************************************
*-- Class:        chkcharacter 
*-- Check box class used to bind to character data - such as a field that takes values Y/N
*
Define Class chkcharacter As checkbox

  Caption = ""
  Value = .F.
  *-- the character to use when the box is checked
  ctruevalue = "Y"
  *-- The character to use when the box is unchecked
  cfalsevalue = "N"
  *-- The character data source for this control
  ccontrolsource = ""
  Name = "chkcharacter"


  *-- Called from the valid top manually update the character data from the logical value
  Procedure updatecontrolsource
    Local llValue, lcField, lcAlias, lcValue

    llValue = This.Value
    lcValue = Iif( This.Value, This.ctruevalue, This.cfalsevalue )

    lcField = Justext( This.ccontrolsource )
    lcAlias = Juststem( This.ccontrolsource )

    *** Update cControlSource from the Control's Value
    *** Check to see if we are updating a form property
    If Upper( Left( This.ccontrolsource, 4 ) ) == 'THIS'
      lcControlSource = This.ccontrolsource
      &lcControlSource = lcValue
    Else
      Replace ( lcField ) With lcValue In ( lcAlias )
    Endif
  Endproc


  *-- Called from the refresh to manually update the logical value from character data
  Procedure refreshvalue
    Local lcValue

    lcValue = Nvl( Evaluate( This.ccontrolsource ), '' )

    *** Update the control's value from its cControlSource
    This.Value = Iif( Left( lcValue, 1 ) == This.ctruevalue, .T., .F. )
  Endproc


  Procedure Refresh
    This.refreshvalue()
    DoDefault()
  Endproc


  Procedure Valid
    This.updatecontrolsource()
  Endproc


  Procedure Init
    This.refreshvalue()
  Endproc

Enddefine
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform