Toggle button

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #47660
    Support
    Keymaster

      Hello

      I have one idea only – painting of button as active manually in the OnPaint event…

      #47690
      JM-DG
      Participant

        Good idea. I'll let you know how it went. 🙂

        #47719
        JM-DG
        Participant

          Here's how I did it. 🙂

          Code:
          var EqIsOn: Boolean;

          procedure TEq.EqOnOffbutClick(Sender: TObject);
          begin
          if EqIsOn=true then
          begin
          EqIsOn:= false;
          EqOnOffbut.Caption := 'Off';
          end
          else
          begin
          EqIsOn:= true;
          EqOnOffbut.Caption := 'On';
          end;
          EqOnOffbut.Down:= EqIsOn;
          end;

          Thanks for the help!

          #47756
          Typograph
          Participant

            1. Put a SpeedButton on the form

            2. Set Property GroupIndex to a value higher than 0

            3. Set allowUp to TRUE

            In Code

            TsSpeedButton(Sander).Down := Not TsSpeedButton(Sander).Down

            #47757
            Typograph
            Participant

              procedure TEq.EqOnOffbutClick(Sender: TObject);

              Const

              Cap : array[0..1] Of String =('Off',On');

              begin

              TsSpeedButton(Sender).Down := Not TsSpeedButton(Sender).Down

              TsSpeedButton(Sender).Caption := Cap[TsSpeedButton(Sender).Down]

              end;

              Thats it….

            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.