logo
down
shadow

Cannot Destroy Dynamically created Menu Item in Delphi


Cannot Destroy Dynamically created Menu Item in Delphi

By : Jarmaine Jackson
Date : November 18 2020, 01:01 AM
I hope this helps . You did not say it, so I have to assume that MySubMenu is a MenuItem of PopupMenu1. If not please clarify.
To delete items from MySubMenu in order to recreate them again later, it's easyest to call the Clear method:
code :
procedure TForm5.Button2Click(Sender: TObject);
begin
  MySubMenu.Clear;
end;
procedure TForm5.Button2Click(Sender: TObject);
var
  mi: TMenuItem;
begin
  while MySubMenu.Count > 0 do
  begin
    mi := MySubMenu.Items[0];
    mi.Free;
  end;
end;


Share : facebook icon twitter icon
jQuery - change the CSS of the menu item's path in the dynamically created menu

jQuery - change the CSS of the menu item's path in the dynamically created menu


By : Reyll
Date : March 29 2020, 07:55 AM
help you fix your problem The way the menu seems to be organized, the click event will bubble up from child li to parent li, so you just need to bind the click event to all menu items and set the background for the current element:
code :
$('#nav li').click(function () {
    $(this).children('a').css('background-color', 'red'); 
});
How do I highlight a item in a dynamically created menu?

How do I highlight a item in a dynamically created menu?


By : JulianJ
Date : March 29 2020, 07:55 AM
it fixes the issue If you pass the same variable via the url - you could try doing something like this -
code :
<a href='diensten2.php?id={<?php echo $row2['blog_id'] ?>}' <?php if($_GET['id'] == $row['blog_id']) { ?>class='active'<?php } ?>>{<?php echo $row2['navigatie'] ?>}</a>;
Dynamically created menu items position giving same item id in navigation drawer

Dynamically created menu items position giving same item id in navigation drawer


By : Prakash E
Date : March 29 2020, 07:55 AM
I wish this help you I have created menu items dynamically in navigation drawer by using following code. , Use Menu.add() with more parameters.
From Documentation
code :
MenuItem add (int groupId, 
                int itemId, 
                int order, 
                CharSequence title)
menu.add(0, 0, 0, "menu item 1")
menu.add(0, 1, 0, "menu item 2")
menu.add(0, 2, 0, "menu item 3")
Dynamically created TPopup menu does not call the OnClick event handlers of its items in Delphi XE4

Dynamically created TPopup menu does not call the OnClick event handlers of its items in Delphi XE4


By : K P
Date : March 29 2020, 07:55 AM
it should still fix some issue Since you are creating your dynamicPopupMenu with the current TForm1 instance as Owner, I'm not really sure you need all the rigmarole of your garbage collector, as the TForm1 instance will destroy it anyway when it itself is destroyed.
Try this:
code :
procedure TForm1.Button1Click(Sender: TObject);
var
  dynamicPopupMenu : tpopupmenu;
  AForm : TForm;
begin
  AForm := TForm.Create(Nil);
  dynamicPopupMenu := tpopupmenu.create(AForm);
  try
    dynamicPOpUpMenu.Tag := 666;
    addMenuItem( dynamicPopupMenu, 'aaa', 1, onmenuitemclick1 );
    addMenuItem( dynamicPopupMenu, 'bbb', 2, onmenuitemclick1 );
    dynamicPopupMenu.popup( 600, 600 );
  finally
    AForm.Release;
  end;
end;
How to destroy the Tchromium (Delphi) component dynamically created?

How to destroy the Tchromium (Delphi) component dynamically created?


By : Prabakaran R
Date : March 29 2020, 07:55 AM
I wish did fix the issue. This behaviour is as designed. Issue 1237 on the Chromium issue tracker is identical to your issue. The relevant excerpt is:
Related Posts Related Posts :
  • Which is current correct indy and open ssl versions to use with delphi2007
  • Delphi Xe2: WH_KEYBOARD won't return left-right virtual key codes
  • Collecting a list/table of version specific information for RAD Studio/Delphi/C++ Builder related development environmen
  • delphi 2009, interface already released
  • chained proxy in delphi
  • Use VCL Styles From Delphi XE7 to Delphi XE2
  • Rotating an image Delphi XE7
  • Understanding waitable timers
  • Delphi Created Images are not displayed
  • former worked code does not work
  • Formatsettings of client are changing when printing in Firemonkey
  • Why does Delphi XE7 IDE hangs and fails on out of memory exception?
  • How to build delphi projects for WIN64 when units inside it uses DesignEditors DesignIntf?
  • How can I set a message unread?? with delphi 7 and imap from indy10
  • How can I save a TTreeview to Windows and keep its hierarchical structure?
  • Nullable scalar types and LiveBindings
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org