How to make Delphi TSpeedButton stay pressed if it is the only one in the group

I'm not sure why TSpeedButton has this property, but when TSpeedButton is the only button of a given group index, it does not stay pressed, regardless of whether the "AllowAllUp" button is clicked. Maybe control of the Jedi will be sufficient, but I hope there is some kind of correction. Any help or jokes appreciated.

By the way, I (still) use Delphi 7, not sure if this is a puzzle.

+10
source share
11 answers

I don’t have D7 here, but in D2006 Speedbutton does not work if the GroupIndex value is> 0.

, , Down-Property OnClick-Eventhandler (, GroupIndex 0).

+16

Delphi 7 (Build 4.453):

  • TSpeedButton
  • set AllowAllUp := true;
  • set GroupIndex := 1;

- .

+10

knight_killer . , delphi:

object SpeedButton1: TSpeedButton
  Left = 152
  Top = 384
  Width = 23
  Height = 22
  AllowAllUp = True
  GroupIndex = 99
end
+2

Delphi , " ".

IDE , , "GroupIndex" - , "0", - NO CODE - NADA!!

+2

, , , . , SpeedButton Down? , --- Down, ...

[edit: replace Checked Down --- TSpeedButton Checked, !]

+1

, "", OnClick. :

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  MyBoolProperty := not MyBoolProperty;
  SpeedButton1.Down := MyBoolProperty;
end;
+1

, , . , SpeedButton , , , :

AllowAllUp := True; 
GroupIndex := 1;

OnClick :

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  if( SpeedButton1.AllowAllUp ) then 
  begin 
    SpeedButton1.AllowAllUp := False; 
    SpeedButton1.Down := True; 
  end else 
  begin 
    SpeedButton1.AllowAllUp := True; 
    SpeedButton1.Down := False; 
  end; 
end;

, , .

, .

0

, GroupIndex AllowAllUp true. , , , , .

0

AllowAllup true, Down - false.

OnClick :

....
btn.AllowAllUp := not btn.AllowAllUp;
btn.Down       := not btn.Down;
....
0

AllowAllUp True.

GroupIndex 0.

OnClick,

 with Speedbutton1 do
 begin
      if tag = 1 then tag := 0 else tag := 1;
      down := (tag = 1);
 end;
0

GroupIndexgroups buttons. Only one button in a group can be active. All must have the same index higher than 0.

AllowAllUp allows you to switch from the button down and up when pressed 2 times in a row.

0
source

All Articles