OlegTimkiv Posted October 14, 2020 Share Posted October 14, 2020 При наведении на кнопку отображаем popupMenu. procedure TMainForm.btnJornalsMouseEnter(Sender: TObject); begin with TExtPopup(pmJornals).MenuControl.JSInterface do begin JSCall('showBy', [btnJornals.JSControl]); JSCall('setPosition', [btnJornals.Left, btnJornals.Top + btnJornals.Height]); end; end; Как сделать закрытие popupMenu после смены фокуса? Quote Link to comment Share on other sites More sharing options...
x11 Posted October 14, 2020 Share Posted October 14, 2020 у кнопки есть событие OnMouseLeave, в нем и скрывайте меню Quote Link to comment Share on other sites More sharing options...
OlegTimkiv Posted October 15, 2020 Author Share Posted October 15, 2020 16 hours ago, x11 said: у кнопки есть событие OnMouseLeave, в нем и скрывайте меню Потом фокусе popupMenu - мы на нем должны закрыть Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 15, 2020 Share Posted October 15, 2020 1 hour ago, OlegTimkiv said: Потом фокусе popupMenu - мы на нем должны закрыть Здравствуйте, Вы решили "проблему"? Quote Link to comment Share on other sites More sharing options...
OlegTimkiv Posted October 15, 2020 Author Share Posted October 15, 2020 Just now, Sherzod said: Здравствуйте, Вы решили "проблему"? Здравствуйте, Нет. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 15, 2020 Share Posted October 15, 2020 18 hours ago, OlegTimkiv said: Как сделать закрытие popupMenu после смены фокуса? Уточните пожалуйста этот момент. Quote Link to comment Share on other sites More sharing options...
OlegTimkiv Posted October 15, 2020 Author Share Posted October 15, 2020 21 minutes ago, Sherzod said: Уточните пожалуйста этот момент. Project017.avi Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 15, 2020 Share Posted October 15, 2020 9 minutes ago, OlegTimkiv said: Project017.avi UniMenuButton? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 15, 2020 Share Posted October 15, 2020 21 minutes ago, OlegTimkiv said: Project017.avi Я проанализирую. Quote Link to comment Share on other sites More sharing options...
OlegTimkiv Posted October 15, 2020 Author Share Posted October 15, 2020 11 minutes ago, Sherzod said: UniMenuButton? Просто button в панели Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 15, 2020 Share Posted October 15, 2020 2 hours ago, OlegTimkiv said: Project017.avi Это решение для меню (mouseout), на данный момент: procedure TMainForm.UniFormReady(Sender: TObject); begin with TExtPopup(UniPopupMenu1).MenuControl.JSInterface do begin JSAddListener('afterrender', 'function(){'+ 'var addMenuMouseOut = function(menu) {'+ 'menu.on({'+ ' mouseleave: function() {'+ ' this.hide();' + TExtPopup(UniPopupMenu1).MenuControl.JSName +'.hide();'+ ' }'+ '});'+ 'menu.items.each(function(item) {'+ ' if (item.menu) {'+ ' addMenuMouseOut(item.menu);'+ ' }'+ '});'+ '}; addMenuMouseOut('+ TExtPopup(UniPopupMenu1).MenuControl.JSName +');'+ '}') end; end; Quote Link to comment Share on other sites More sharing options...
OlegTimkiv Posted October 15, 2020 Author Share Posted October 15, 2020 49 minutes ago, Sherzod said: Это решение для меню (mouseout), на данный момент: procedure TMainForm.UniFormReady(Sender: TObject); begin with TExtPopup(UniPopupMenu1).MenuControl.JSInterface do begin JSAddListener('afterrender', 'function(){'+ 'var addMenuMouseOut = function(menu) {'+ 'menu.on({'+ ' mouseleave: function() {'+ ' this.hide();' + TExtPopup(UniPopupMenu1).MenuControl.JSName +'.hide();'+ ' }'+ '});'+ 'menu.items.each(function(item) {'+ ' if (item.menu) {'+ ' addMenuMouseOut(item.menu);'+ ' }'+ '});'+ '}; addMenuMouseOut('+ TExtPopup(UniPopupMenu1).MenuControl.JSName +');'+ '}') end; end; Спасибо! Всё работает! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 15, 2020 Share Posted October 15, 2020 Отлично! 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.