Recent

Author Topic: Joint twe popup ?  (Read 693 times)

majid.ebru

  • Hero Member
  • *****
  • Posts: 530
Joint twe popup ?
« on: November 01, 2022, 12:15:43 pm »
Hi

i have two popup.

how can i joint these and show them in one pupop ?

thank you

wp

  • Hero Member
  • *****
  • Posts: 13486
Re: Joint twe popup ?
« Reply #1 on: November 01, 2022, 12:53:20 pm »
Basic idea:

Code: Pascal  [Select][+][-]
  1. procedure MergePopups(AResult, APopup1, APopup2: TPopupMenu);
  2. var
  3.   i: Integer;
  4.   item: TMenuItem;
  5. begin
  6.   AResult.Items.Clear;
  7.  
  8.   for i := 0 to APopup1.Items.Count-1 do
  9.   begin
  10.     item := TMenuItem.Create(AResult.Owner);
  11.     item.Assign(APopup1.Items[i]);
  12.     AResult.Items.Add(item);
  13.   end;
  14.  
  15.   item := TMenuItem.Create(AResult.Owner);
  16.   item.Caption := '-';
  17.   AResult.Items.Add(item);
  18.  
  19.   for i := 0 to APopup2.Items.Count-1 do
  20.   begin
  21.     item := TMenuItem.Create(AResult.Owner);
  22.     item.Assign(APopup2.Items[i]);
  23.     AResult.Items.Add(item);
  24.   end;
  25. end;
« Last Edit: November 01, 2022, 12:56:04 pm by wp »

 

TinyPortal © 2005-2018