[Solved]Trigger a drop-down menu with a button click lazarus / 21-General ---------------------------------------------------------------------- bobonwhidbey · 2024-11-18 18:00 I want a drop-down menu to appear via a button click rather than a click on one of the TMainMenu items; e.g. MenuItem2. Is that possible and how would I do it? ---------------------------------------------------------------------- jamie · 2024-11-18 22:19 I see you are on winders!!!!! https://stackoverflow.com/questions/40712886/can-you-programatically- show-a-menu-using-the-win32-api jamie ---------------------------------------------------------------------- VisualLab · 2024-11-19 07:39 I don't know if this is what you mean, but you can display a popup menu after pressing a button: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Menus; type  {TForm1}  TForm1 = class(TForm)    Button1: TButton;    MenuItem1: TMenuItem;    MenuItem2: TMenuItem;    MenuItem3: TMenuItem;    PopupMenu1: TPopupMenu;    procedure FormCreate(Sender: TObject);    procedure Button1Click(Sender: TObject);  private    PopupMenuNotVisible: Boolean;  public   end; var  Form1: TForm1; implementation {$R *.lfm} {TForm1} procedure TForm1.FormCreate(Sender: TObject);begin  PopupMenuNotVisible := True;end; procedure TForm1.Button1Click(Sender: TObject);var  LPoint: TPoint;begin  if PopupMenuNotVisible   then    begin     LPoint.X := Button1.Left;     LPoint.Y := Button1.Top + Button1.Height;     LPoint := Form1.ClientToScreen(LPoint);     PopupMenu1.PopUp(LPoint.X, LPoint.Y);    end;  PopupMenuNotVisible := not PopupMenuNotVisible;end; end. ---------------------------------------------------------------------- bobonwhidbey · 2024-11-19 22:30 Although I was thinking of just opening the existing drop-down menu, creating a 2nd and equal drop-down list with PopupMenu works very well.  THANK YOU. I'm having problems using the Checked property on the various sub-menu items on both the PopupMenu and the MainMenu. When I create the Menulist, the appropriate items are checked. When I later check an unchecked menuItem, all the other items become unchecked. Setting Checked=true to an already checked item does not cause the other items to become unchecked. What's happening? ---------------------------------------------------------------------- MarkMLl · 2024-11-20 12:45 Quote from: bobonwhidbey on November 19, 2024, 11:30:41 pmI'm having problems using the Checked property on the various sub-menu items on both the PopupMenu and the MainMenu. When I create the Menulist, the appropriate items are checked. When I later check an unchecked menuItem, all the other items become unchecked. Setting Checked=true to an already checked item does not cause the other items to become unchecked. What's happening? Check GroupIndex and RadioItem in each entry. I've just checked and I've been able to mix these within the same menu in the past, but I do have a very vague recollection that there's something odd when you try to manipulate the checked state under code control... that might also apply to the general RadioButton and CheckBox controls, and it might be widget-set- and version-specific. As an aside, please make sure that you put the version of FPC/Lazarus plus the OS etc. somewhere in the body of your message. The sig is definitely not the right place for that info, since as soon as you change it /all/ messages that you've ever posted will be affected, making the forum much less useful as an archive of useful information. MarkMLl