' Custom Component Creation for Rapid-Q by William Yu ' ' QAniButton - Animated button (text changes) ' - For Windows or Linux/Unix ' ' PROPERTIES: ' Delay - Wait how long before text changes (in milliseconds) ' ' METHODS: ' AddCaptions - Add captions in order that they appear ' Clear - Clear all captions $TYPECHECK ON $APPTYPE GUI TYPE QAniButton EXTENDS QButton '-- PROTECTED Properties Timer1 AS QTimer CurrentState AS INTEGER NumStates AS INTEGER Captions(100) AS STRING '-- PUBLIC Properties Delay AS INTEGER '-- PUBLIC Methods SUBI AddCaptions (...) DIM I AS INTEGER FOR I = 1 TO ParamStrCount QAniButton.Captions(QAniButton.NumStates+I-1) = ParamStr$(I) NEXT IF QAniButton.NumStates = 0 THEN QAniButton.Caption = QAniButton.Captions(0) END IF QAniButton.NumStates = QAniButton.NumStates + ParamStrCount-1 END SUBI SUB Clear QAniButton.NumStates = 0 QAniButton.CurrentState = 0 QAniButton.Captions(0) = "" QAniButton.Caption = "" END SUB EVENT Timer1.OnTimer QAniButton.Timer1.Interval = QAniButton.Delay IF QAniButton.CurrentState >= QAniButton.NumStates THEN QAniButton.CurrentState = 0 ELSE QAniButton.CurrentState = QAniButton.CurrentState + 1 END IF QAniButton.Caption = QAniButton.Captions(QAniButton.CurrentState) END EVENT CONSTRUCTOR Delay = 500 '' Half a second Timer1.Interval = QAniButton.Delay Timer1.Enabled = 1 '' True Width = 80 Height = 30 CurrentState = 0 NumStates = 0 END CONSTRUCTOR END TYPE '-- Test Component DECLARE SUB ButtonClick CREATE Form AS QForm Center CREATE AniButton AS QAniButton Top = 50 Left = 100 AddCaptions "Click", "Me", "Now!" OnClick = ButtonClick END CREATE ShowModal END CREATE SUB ButtonClick AniButton.Clear AniButton.AddCaptions "Thank", "You" END SUB