Jump to content

TUniPopupMenu


picyka

Recommended Posts

30 minutes ago, picyka said:

I would like to order the menus by caption Something like,

UniPoupMenu.Items.Sort;

One possible solution:

1. 

type
  TXPopupMenu = class(TUniPopupMenu)

  end;

2. OnReady event ->

procedure TMainForm.UniFormReady(Sender: TObject);
begin
  with TXPopupMenu(UniPopupMenu1).MenuControl.JSInterface do
    JSAddListener('afterrender', 'function(){this.items.sort(function(item1, item2) {return item1.text.localeCompare(item2.text)})}')
end;

 

Link to comment
Share on other sites

1 hour ago, Sherzod said:

One possible solution:

1. 

type
  TXPopupMenu = class(TUniPopupMenu)

  end;

2. OnReady event ->

procedure TMainForm.UniFormReady(Sender: TObject);
begin
  with TXPopupMenu(UniPopupMenu1).MenuControl.JSInterface do
    JSAddListener('afterrender', 'function(){this.items.sort(function(item1, item2) {return item1.text.localeCompare(item2.text)})}')
end;

 

It works!

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...