FXSystems Posted February 8, 2021 Share Posted February 8, 2021 Hi, all. I need to do something like: I show the popup menu: PopupMenu.Popup (X, Y, Sender); It's work perfect, but: I need to detect when a popup is closed without clicking on any item in the list. How to do that? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 8, 2021 Share Posted February 8, 2021 Hi, Just now, FXSystems said: I need to detect when a popup is closed without clicking on any item in the list. How to do that? First of all, please specify, which edition and build of UniGUI are you using? Quote Link to comment Share on other sites More sharing options...
FXSystems Posted February 8, 2021 Author Share Posted February 8, 2021 Now i use uniGUI Complete - Professional Edition Version: 1.90.0.1539 Sorry I forgot I should specify it. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 8, 2021 Share Posted February 8, 2021 19 minutes ago, FXSystems said: Now i use uniGUI Complete - Professional Edition Please adjust your forum email address: Quote Link to comment Share on other sites More sharing options...
FXSystems Posted February 8, 2021 Author Share Posted February 8, 2021 I've already done it. I have assigned an email address for the Forum. It is the same as the registration email. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 8, 2021 Share Posted February 8, 2021 3 hours ago, FXSystems said: I need to detect when a popup is closed without clicking on any item in the list. How to do that? I will check. Quote Link to comment Share on other sites More sharing options...
FXSystems Posted February 8, 2021 Author Share Posted February 8, 2021 Thank you very much. It will be very useful to me. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 8, 2021 Share Posted February 8, 2021 18 minutes ago, FXSystems said: It will be very useful to me. 4 hours ago, FXSystems said: I show the popup menu: PopupMenu.Popup (X, Y, Sender); Where do you show? Quote Link to comment Share on other sites More sharing options...
FXSystems Posted February 9, 2021 Author Share Posted February 9, 2021 For example on uniPanel. Everything works fine but I need a popup closing event without selecting an option. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 9, 2021 Share Posted February 9, 2021 1 hour ago, FXSystems said: For example on uniPanel. Everything works fine but I need a popup closing event without selecting an option. Approximate solution. 1. type TXPopupMenu = class(TUniPopupMenu) end; 2. procedure TMainForm.UniFormReady(Sender: TObject); begin with TXPopupMenu(UniPopupMenu1).MenuControl.JSInterface do begin JSAddListener('beforeshow', 'function(me){me._clicked=false}'); JSAddListener('click', 'function(me){me._clicked=true}'); JSAddListener('hide', 'function(me){Ext.defer(function(){if (me._clicked == false) {ajaxRequest('+ UniPanel1.JSName +', "hidemenu", [])}}, 100)}'); end; end; 3. procedure TMainForm.UniPanel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if Button = mbRight then UniPopupMenu1.Popup (X, Y, Sender); end; 4. procedure TMainForm.UniPanel1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'hidemenu' then ShowMessage('hidemenu') end; 1 Quote Link to comment Share on other sites More sharing options...
FXSystems Posted February 9, 2021 Author Share Posted February 9, 2021 Thank you very much. I will check and confirm. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 9, 2021 Share Posted February 9, 2021 Thanks. Quote Link to comment Share on other sites More sharing options...
FXSystems Posted February 11, 2021 Author Share Posted February 11, 2021 I used the code from you and make a lot of tests. Works great. Thank you again. 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.