Automatic dropdown menu for sButton

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34882
    twobit
    Participant

    Hey,

    I'm using a sButton paired with a dropdown menu and I'd like to have the latter automatically open when I press the button. The button's style is set to bsSplitButton. At the moment, I can only reveal the associated popup menu by clicking the small arrow on the right side. What I'd like to know is how to make the menu open when I press it. I browsed through the button's procedures, but no avail.

    Thanks,

    Two-bit

    #47172
    Support
    Keymaster

    Hello

    I think, you can use this code :

    Code:
    procedure TForm1.sButton1Click(Sender: TObject);
    var
    p : TPoint;
    begin
    p := sButton1.ClientToScreen(Point(0, 0));
    PopupMenu1.Popup(p.X, p.Y + sButton1.Height);
    end;
    #47173
    twobit
    Participant

    Hey, thank you SO MUCH. It worked like a charm. Great trick.

    Kind regards,

    Twobit.

    'Support' wrote:

    Hello

    I think, you can use this code :

    Code:
    procedure TForm1.sButton1Click(Sender: TObject);
    var
    p : TPoint;
    begin
    p := sButton1.ClientToScreen(Point(0, 0));
    PopupMenu1.Popup(p.X, p.Y + sButton1.Height);
    end;

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