Board index » delphi » popup menu

popup menu

Hi,

How can I have the popup menu pop up just next to the ToolButton on the
right?

I am using Delphi 3.

Thanks in advance,

af

 

Re:popup menu


Quote
In article <3635D76C.ADFF9...@hkg.com>, Artus fung wrote:
> How can I have the popup menu pop up just next to the ToolButton on the
> right?

Using the popup menus Popup method you can display it at any screen
position you want. The coordinates to pass are screen coordinates, so you
have to convert from the client coordinate system of the toolbuttons parent
control to screen coordinates using that parents ClientToScreen method.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitely requested!

Re:popup menu


Dear all,

Let me explain the situation more cleary.

I have a toolbar and a popup menu on a form, the toolbar is located on
the left side of the form and had several toolbuttons which line up
vertically on it.

I have assigned the popup menu as the DropdownMenu of the toolbutton.

Once I click on the top most toolbutton, the dropdown menu appear below
that toolbutton and get all other toolbuttons hided from it.

So is there any method could make the menu show up on the right side of
the toolbutton? Can anyone help me?

Many thanks,

af

Re:popup menu


you can write your own OnClick event for the buttons in which you can popup
the menu anywhere you want. Below is some code I wrote for a vertical tool
bar on the right side of the screen.

procedure tMainControlPanelForm.MenuButtonClick (Sender : tObject);

var  pt             : tPoint;

begin
if (Sender is tToolButton)
then begin
     with tToolButton (Sender) do
          begin
          if DropDownMenu <> nil
          then begin
               pt := ClientToScreen (Point (0, 0));
               DropDownMenu.PopUp (pt.x, pt.y);
               end;
          end;
     end;
end;

Quote
artus fung wrote in message <36360FEB.89E24...@hkg.com>...
>Dear all,

>Let me explain the situation more cleary.

>I have a toolbar and a popup menu on a form, the toolbar is located on
>the left side of the form and had several toolbuttons which line up
>vertically on it.

>I have assigned the popup menu as the DropdownMenu of the toolbutton.

>Once I click on the top most toolbutton, the dropdown menu appear below
>that toolbutton and get all other toolbuttons hided from it.

>So is there any method could make the menu show up on the right side of
>the toolbutton? Can anyone help me?

>Many thanks,

>af

Other Threads