Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 52891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:58:40+00:00 2026-05-10T16:58:40+00:00

I am using a popup menu in Delphi. I want to use it in

  • 0

I am using a popup menu in Delphi. I want to use it in a ‘radio group’ fashion where if the user selects an item it is checked and the other items are not checked. I tried using the AutoCheck property, but this allows multiple items to be checked. Is there a way to set the popup menu so that only one item can be checked?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:58:41+00:00Added an answer on May 10, 2026 at 4:58 pm

    Zartog is right, but if you want to keep the checkbox, assign this event to every item in the popup menu.

    Note that this code is a little hairy looking because it does not depend on knowing the name of your popup menu (hence, looking it up with ‘GetParentComponent’).

    procedure TForm2.OnPopupItemClick(Sender: TObject); var   i : integer; begin   with (Sender as TMenuItem) do begin     //if they just checked something...     if Checked then begin       //go through the list and *un* check everything *else*       for i := 0 to (GetParentComponent as TPopupMenu).Items.Count - 1 do begin         if i <> MenuIndex then begin  //don't uncheck the one they just clicked!           (GetParentComponent as TPopupMenu).Items[i].Checked := False;         end;  //if not the one they just clicked       end;  //for each item in the popup     end;  //if we checked something   end;  //with end; 

    You can assign the event at runtime to every popup box on your form like this (if you want to do that):

    procedure TForm2.FormCreate(Sender: TObject); var   i,j: integer; begin   inherited;    //look for any popup menus, and assign our custom checkbox handler to them   if Sender is TForm then begin     with (Sender as TForm) do begin       for i := 0 to ComponentCount - 1 do begin         if (Components[i] is TPopupMenu) then begin           for j := 0 to (Components[i] as TPopupMenu).Items.Count - 1 do begin             (Components[i] as TPopupMenu).Items[j].OnClick := OnPopupItemClick;           end;  //for every item in the popup list we found         end;  //if we found a popup list       end;  //for every component on the form     end;  //with the form   end;  //if we are looking at a form end; 

    In response to a comment below this answer: If you want to require at least one item to be checked, then use this instead of the first code block. You may want to set a default checked item in the oncreate event.

    procedure TForm2.OnPopupItemClick(Sender: TObject); var   i : integer; begin   with (Sender as TMenuItem) do begin     //go through the list and make sure *only* the clicked item is checked     for i := 0 to (GetParentComponent as TPopupMenu).Items.Count - 1 do begin       (GetParentComponent as TPopupMenu).Items[i].Checked := (i = MenuIndex);     end;  //for each item in the popup   end;  //with end; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I am using a popup menu item when right clicking an
I'm having a problem with using a TStringGrid and Popup menu I want to
I'm displaying a popup menu using TrackPopupMenu and would like to know when it
I have a JComboBox on my Panel. One of the popup menu items is
I want to replace all the popup menus displayed by delphi in the TCustomEdit
I am using this jQuery context popup menu extension: http://www.trendskitchens.co.nz/jquery/contextmenu/ This context menu is
I'm using mouseleave to close a popup menu. This works correctly in all of
There are two conditions for a popup menu to appear, I am using the
I am using menuContributions+popup to show a context menu in my plugin.xml. I need
I have a NSPopUpButton and I want the Menu Items in it to display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.