TPopupMenu Erase all Item

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34085
    BuzzLeclaire
    Participant

    Hello all,

    Sorry for my speak english, i am french.

    When i delete all item as :

    Code:
    procedure TFFichiers.DelItem;
    Var
    i: Integer;
    begin
    for i := PopupMenuVues.Items.Count – 1 downto 0 do
    PopupMenuVues.Items.Delete(i);
    end;

    Then when I created new

    Code:
    // …
    MenuItem := TMenuItem.Create(PopupMenuVues);
    MenuItem.Caption := FieldByName('Nom').AsString;
    MenuItem.Hint := FieldByName('Tri').AsString;
    if FieldByName('Initiale').AsBoolean then
    begin
    Vues := FieldByName('Nom').AsString;
    MenuItem.Checked := FieldByName('Initiale').AsBoolean;
    end;
    MenuItem.OnClick := VueClick;
    PopupMenuVues.Items.Add(MenuItem);

    // …

    Then we lose the skin !!!

    To solve my problem, I am obliged to

    1) Hide

    2) AddItem

    3) Show

    my form

    The problem is that I already do in the show Additem….

    where have this problem?

    Thx

    #43712
    emailaya
    Participant

    after adding all the relevant items to the menu add this line

    .SkinableMenus.HookPopupMenu(pmMenu, True);

    also you can delete menu items by a simple pmMenu.items.Clear;

    #43714
    BuzzLeclaire
    Participant

    Hello, emailaya

    Thx for help.

    This solution is perfect.

    😉

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