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

  • Home
  • SEARCH
  • 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 132253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:14:00+00:00 2026-05-11T06:14:00+00:00

I have a popup menu and I want one of the items to open

  • 0

I have a popup menu and I want one of the items to open a sub-menu with a dynamically created list (it’s a list of user defined flags). Here’s how I’m creating the menu items (FlagAs is the menu item I want to attach the sub-menu to):

lNewMenuItems: array[0..flagCount] of tMenuItem;  for I := 0 to flagCount do begin   { Create a new menu item }   lNewMenuItems[I] := tMenuItem.Create(FlagAs);   lNewMenuItems[I].Caption := FlagNames[I];   lNewMenuItems[I].Tag := I; { Tag with the flag number }   lNewMenuItems[I].OnClick := miFlagClick; end;  FlagAs.Add(lNewMenuItems); 

The miFlagClick handler simply toggles the checked status of its sender:

procedure TMyForm.miFlagClick(Sender: TObject); begin   (Sender as tMenuItem).Checked := not (Sender as tMenuItem).Checked; end; 

The items get added perfectly, but they don’t get checked when I click on them. The event handler is being called EDIT: and Sender is the correct menu item, but the check mark doesn’t appear next time I open the menu.

What am I doing wrong? Or am I going about the menu creation in the wrong way? (Note flagCount may change in the future, but is defined as a constant in the code)

EDIT: the above does actually work – see my answer below

  • 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-11T06:14:01+00:00Added an answer on May 11, 2026 at 6:14 am

    I tried the following in Delphi 2009 and it worked fine:

    procedure TForm5.FormCreate(Sender: TObject); var   i : Integer;   mis : array[0..3] of TMenuItem; begin   for i := 0 to 3 do begin     mis[i] := tMenuItem.Create(SubMenu);     NewMenu(mis[i]);   end;   SubMenu.Add(mis); end;  procedure TForm5.NewMenu(var mi: TMenuItem); begin   mi.Caption := 'Test';   mi.OnClick := TestClick; end;  procedure TForm5.TestClick(Sender: TObject); begin  (Sender as tMenuItem).Checked := not (Sender as tMenuItem).Checked; end; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer One way of handling this is to load that list… May 11, 2026 at 2:02 pm
  • added an answer An OR (or an in) almost works as if each… May 11, 2026 at 2:02 pm
  • added an answer I like the general idea, but I do see one… May 11, 2026 at 2:02 pm

Related Questions

I have some markup for a popup menu that works in firefox but not
I have a page which spawns a popup browser window. I have a JavaScript
I have a need to open a popup detail window from a gridview (VS
I have a modal popup that initially shows some content but expands a div
I have a gridview that is within an updatepanel for a modal popup I
Here is my current situation: I have a web page containing a couple scrollable
It's been a while since I used GTK+, and the last time I did
Been searching everywhere and can't find a way to do this. I have a
I am having a frame-based webpage with 3 frames. A topliner, a navigation on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.