updating checkboxes?
Posted: Tue Feb 14, 2006 10:46 am
I am using several checkboxes in my program, and when I declare them i call a function for each one so that if one is ticked, if the user selects a different one then the focus will be changed and the first checkbox they selected will become blank.
CODE;
REDEFINE CHECKBOX oRubble VAR mRubble ID 104 OF oDlg VALID RubbleVal()
REDEFINE CHECKBOX oHardboard VAR mHardboard ID 105 OF oDlg VALID HardboardVal()
REDEFINE CHECKBOX oTreated VAR mTreated ID 106 OF oDlg VALID TreatedVal()
REDEFINE CHECKBOX oFerrous VAR mFerrous ID 107 OF oDlg VALID FerrousVal()
REDEFINE CHECKBOX oOrganic VAR mOrganic ID 108 OF oDlg VALID OrganicVal()
However, when testing this, I notice that I can still select multiple checkboxes and nothing is updated. here is the code I am using for the val functions i am calling in the VALIDS.
CODE;
STATIC FUNCTION RubbleVal
IF mRubble
mHardboard := .F.
mTreated := .F.
mFerrous := .F.
mOrganic := .F.
oHarboard:Refresh()
oTreated:Refresh()
oFerrous:Refresh()
oOrganic:Refresh()
ENDIF
RETURN .T.
STATIC FUNCTION HardboardVal
IF mHardboard
mRubble := .F.
mTreated := .F.
mFerrous := .F.
mOrganic := .F.
oRubble:Refresh()
oTreated:Refresh()
oFerrous:Refresh()
oOrganic:Refresh()
ENDIF
RETURN .T.
STATIC FUNCTION TreatedVal
IF mTreated
mRubble := .F.
mHardboard := .F.
mFerrous := .F.
mOrganic := .F.
oRubble:Refresh()
oHardboard:Refresh()
oFerrous:Refresh()
oOrganic:Refresh()
ENDIF
RETURN .T.
STATIC FUNCTION FerrousVal
IF mFerrous
mRubble := .F.
mHardboard := .F.
mTreated := .F.
mOrganic := .F.
oRubble:Refresh()
oHardBoard:Refresh()
oTreated:Refresh()
oOrganic:Refresh()
ENDIF
RETURN .T.
STATIC FUNCTION OrganicVal
IF mOrganic
mRubble := .F.
mHardboard := .F.
mTreated := .F.
mFerrous := .F.
oRubble:Refresh()
oHardboard:Refresh()
oTreated:Refresh()
oFerrous:Refresh()
ENDIF
RETURN .T.
Is what I am trying to do possible with checkboxes, or am I wasting my time with them. I know I could use radiobuttons but if I could get this to work in the same way that would be preferable.
Thanks for any comments or advice.
CODE;
REDEFINE CHECKBOX oRubble VAR mRubble ID 104 OF oDlg VALID RubbleVal()
REDEFINE CHECKBOX oHardboard VAR mHardboard ID 105 OF oDlg VALID HardboardVal()
REDEFINE CHECKBOX oTreated VAR mTreated ID 106 OF oDlg VALID TreatedVal()
REDEFINE CHECKBOX oFerrous VAR mFerrous ID 107 OF oDlg VALID FerrousVal()
REDEFINE CHECKBOX oOrganic VAR mOrganic ID 108 OF oDlg VALID OrganicVal()
However, when testing this, I notice that I can still select multiple checkboxes and nothing is updated. here is the code I am using for the val functions i am calling in the VALIDS.
CODE;
STATIC FUNCTION RubbleVal
IF mRubble
mHardboard := .F.
mTreated := .F.
mFerrous := .F.
mOrganic := .F.
oHarboard:Refresh()
oTreated:Refresh()
oFerrous:Refresh()
oOrganic:Refresh()
ENDIF
RETURN .T.
STATIC FUNCTION HardboardVal
IF mHardboard
mRubble := .F.
mTreated := .F.
mFerrous := .F.
mOrganic := .F.
oRubble:Refresh()
oTreated:Refresh()
oFerrous:Refresh()
oOrganic:Refresh()
ENDIF
RETURN .T.
STATIC FUNCTION TreatedVal
IF mTreated
mRubble := .F.
mHardboard := .F.
mFerrous := .F.
mOrganic := .F.
oRubble:Refresh()
oHardboard:Refresh()
oFerrous:Refresh()
oOrganic:Refresh()
ENDIF
RETURN .T.
STATIC FUNCTION FerrousVal
IF mFerrous
mRubble := .F.
mHardboard := .F.
mTreated := .F.
mOrganic := .F.
oRubble:Refresh()
oHardBoard:Refresh()
oTreated:Refresh()
oOrganic:Refresh()
ENDIF
RETURN .T.
STATIC FUNCTION OrganicVal
IF mOrganic
mRubble := .F.
mHardboard := .F.
mTreated := .F.
mFerrous := .F.
oRubble:Refresh()
oHardboard:Refresh()
oTreated:Refresh()
oFerrous:Refresh()
ENDIF
RETURN .T.
Is what I am trying to do possible with checkboxes, or am I wasting my time with them. I know I could use radiobuttons but if I could get this to work in the same way that would be preferable.
Thanks for any comments or advice.