I create with Delphi 2009 Toolbuttons in a toolbar like it is desribed here: Create TToolbutton runtime
The difference is that I assign an action also at runtime. My code is as follows:
Function TSymbolVisWin.MakeButton(BCnt:integer; Act:TAction):integer;
var
TB : TToolButton;
ACnt, Ind: Integer;
begin
TB:=TToolButton.Create(ListBar);
try
with TB {NB} do
begin
Parent:=ListBar;
Action:=act; // here seems to be the difference
Style:=tbsButton;
grouped:=false;
Enabled:=true;
ShowHint:=True;
Tag:=BCnt;
Hint:=Act.Hint;
caption:='';
Wrap:=False;
ImageIndex:=Act.ImageIndex;
// here comes the problem
if ListBar.ButtonCount > 0 then
Left:=ListBar.Buttons[ListBar.ButtonCount-1].Left+tb.Width
else
Left:=0; }
// end of problem
end;
except
end;
When I leave the lines (marked problem) in, I see followin strange behaviour:
I press the button and the assigned action is fired, but the button two buttons left is set to down. when I press an other button again the button two buttons left get down and the button before gets up.
I need help, I have no idea for the reason
Kind regards
Christine
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…