[Gambas-user] Iterating through and enabling and disabling controls on a form...
Stephen Bungay
sbungay at ...981...
Tue Feb 6 05:15:52 CET 2007
ControlHandle.Enabled = True doesn't set Enabled to True if the form has
Enabled set to False by default. However, if Enabled is set to True by
default then ControlHandle.Enabled can successfully toggle the value, thus
Disabling and Enabling the control. Is this a bug?
' Iterate through the buttons on a form and Enable or Disable them
' depending on if their tag value exists in the SkillSet Collection.
PRIVATE SUB SetControlsState()
DIM ControlHandle AS Control
DIM X AS Integer
FOR EACH ControlHandle IN ME.Controls
SELECT CASE Object.Type(ControlHandle)
CASE "Button"
' SkillSet is a collection.
FOR X = 1 TO ME.SkillSet.Count
IF CInt(ControlHandle.Tag) = ME.SkillSet[X].ID THEN
ControlHandle.Enabled = TRUE
ControlHandle.BackColor = Color.Green
ELSE
ControlHandle.Enabled = FALSE
ControlHandle.BackColor = Color.DarkGreen
END IF
NEXT
END SELECT
NEXT
END
More information about the User
mailing list