Having troubles with skinning popups

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #35924
    DeadC0der
    Participant

    Hi everyone

    I'm just having problem with skinning popup menus when I simply try to dynamically add a New MenuItem to it actually , I have to clear all the items except the first each time OnPopUp event dispatch then create a new items here is an example of what I'm talking about

    Code:
    procedure TForm3.pm1Popup(Sender: TObject);
    var i:Integer;mi:TMenuItem;
    begin

    for i:=pm1.Items.Count-1 downto 1 do
    pm1.Items.Free;
    mi:=TMenuItem.Create(pm1);
    mi.Caption:=inttostr(Random(10));
    pm1.Items.Add(mi);

    end;

    where the first item get skinned automatically the others doesn't :wacko:

    any help would be much appreciated

    Best Regards

    #51121
    CheshireCat
    Participant

    Hello and welcome to the AC-Forum,

    the following code snippet should work:

    Code:
    procedure TForm2.pm1Popup(Sender: TObject);
    var i:Integer;
    mi:TMenuItem;

    begin
    for i:=pm1.Items.Count-1 downto 1 do
    pm1.Items.Free;
    mi:=TMenuItem.Create(pm1);
    mi.Caption:=inttostr(Random(10));
    pm1.Items.Add(mi);
    sSkinManager1.SkinableMenus.HookPopupMenu(pm1, True); // <-- Add this line
    end;

    I hope I could help you …

    #51123
    DeadC0der
    Participant

    Thanx a lo bro 😀

    I really appreciate your concern 😛 now it works like crystal lOl

    kudos 2 ya :a3:

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