On Mon, 9 Apr 2012 11:48:33 +0300
Juha Manninen <[email protected]> wrote:

> 2012/4/9 Richard Mace <[email protected]>
> 
> > Hi,
> > I have a TToolButton in a tool bar, with it's style set to tbsDropDown and
> > have linked the DropDownMenu property to a drop down menu.
> > All is working fine when I click on the "down arrow" to the right of the
> > button, however, I'd really like the button to also activate the dropdown
> > menu when it is clicked.
> > Could someone give me an example of how I could code that please for the
> > OnClick event of the button?

procedure TForm1.ToolButton1Click(Sender: TObject);
var
  APoint: TPoint;
begin
  APoint := ToolButton1.ClientToScreen(Point(0, ToolButton1.ClientHeight));
  if ToolBar1.IsRightToLeft then Inc(APoint.X, ToolButton1.Width);
  ToolButton1.DropdownMenu.PopUp(APoint.X,APoint.Y);
end;

 
> Don's set the style to tbsDropDown.
> As an example, you can look at Lazarus sources. MoreBitBtn is set in
> packager/PackageEditor.pas.


Mattias

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to