picyka Posted March 15 Share Posted March 15 Is there a possibility to order the menu items? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 15 Share Posted March 15 8 minutes ago, picyka said: Is there a possibility to order the menu items? Hello, Sorry, what do you mean? Quote Link to comment Share on other sites More sharing options...
picyka Posted March 15 Author Share Posted March 15 I would like to order the menus by caption Something like, UniPoupMenu.Items.Sort; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 15 Share Posted March 15 Ok I will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 15 Share Posted March 15 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; Quote Link to comment Share on other sites More sharing options...
picyka Posted March 15 Author Share Posted March 15 I'll test it, thanks Doctor JS.😁 Quote Link to comment Share on other sites More sharing options...
picyka Posted March 15 Author Share Posted March 15 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! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.