SayeyeZohor Posted August 20, 2019 Share Posted August 20, 2019 how to auto width unipopupmenu change to parent unimenubutton? @Sherzod Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 20, 2019 Share Posted August 20, 2019 Hi, OK I will check. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 20, 2019 Share Posted August 20, 2019 1 hour ago, SayeyeZohor said: how to auto width unipopupmenu change to parent unimenubutton? One of the possible solutions for now: UniMenuButton1.ClientEvents.ExtEvents -> function menushow(sender, menu, eOpts) { var me=sender.menu; if (me) { me.setWidth(sender.getWidth()); me.items.each(function(item){ item.setMinWidth(sender.getWidth()-6) }); } } 1 Quote Link to comment Share on other sites More sharing options...
SayeyeZohor Posted August 20, 2019 Author Share Posted August 20, 2019 33 minutes ago, Sherzod said: One of the possible solutions for now: UniMenuButton1.ClientEvents.ExtEvents -> function menushow(sender, menu, eOpts) { var me=sender.menu; if (me) { me.setWidth(sender.getWidth()); me.items.each(function(item){ item.setMinWidth(sender.getWidth()-6) }); } } It is displayed the first time and then corrected... and then fix function menushow(sender, menu, eOpts) --- > menubeforeshow ? ??????????? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 20, 2019 Share Posted August 20, 2019 8 minutes ago, SayeyeZohor said: It is displayed the first time and then corrected... Hmm Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 20, 2019 Share Posted August 20, 2019 Can you try another solution? 1. Remove: function menushow(sender, menu, eOpts) { /*var me=sender.menu; if (me) { me.setWidth(sender.getWidth()); me.items.each(function(item){ item.setMinWidth(sender.getWidth()-6) }); }*/ } 2. type TXPopupMenu = class(TUniPopupMenu) end; 3. UniFormReady event: procedure TMainForm.UniFormReady(Sender: TObject); begin with TXPopupMenu(UniPopupMenu1).MenuControl.JSInterface do JSConfig('minWidth', [UniMenuButton1.Width-6]); end; 2 Quote Link to comment Share on other sites More sharing options...
SayeyeZohor Posted August 20, 2019 Author Share Posted August 20, 2019 7 minutes ago, Sherzod said: Can you try another solution? 1. Remove: function menushow(sender, menu, eOpts) { /*var me=sender.menu; if (me) { me.setWidth(sender.getWidth()); me.items.each(function(item){ item.setMinWidth(sender.getWidth()-6) }); }*/ } 2. type TXPopupMenu = class(TUniPopupMenu) end; 3. UniFormReady event: procedure TMainForm.UniFormReady(Sender: TObject); begin with TXPopupMenu(UniPopupMenu1).MenuControl.JSInterface do JSConfig('minWidth', [UniMenuButton1.Width-6]); end; tnxxxxxxxxxxxxxxxxx 1 Quote Link to comment Share on other sites More sharing options...
fraxzi Posted June 4, 2020 Share Posted June 4, 2020 Hi @Sherzod, I am not an expert in JS (maybe yet) but I hope this can be set as property on the next release. Thanks, Frances 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.