Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checkbox reacts to Y/N field
Message
De
29/01/2007 17:10:58
 
 
À
29/01/2007 10:44:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01189996
Message ID:
01190310
Vues:
13
- 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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform