eric Posted December 19, 2015 Share Posted December 19, 2015 Hello, I'd like to use a tpopupmenu in a treeview. the feature works well, when I right click I get my popupmenu on the correct item. procedure TUniWizard_Update.UniTreeView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin if Button=mbRight then UniPopupMenu1.Popup(X, Y,unitreeview1); end; The problem is that the TreeView1Change event is fired only on the left Click . so I don't know How to get the selected node in a right click. Thanks for your help eric Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2015 Share Posted December 19, 2015 Hi eric, For now you can try: http://forums.unigui.com/index.php?/topic/5714-treeview-hints/&do=findComment&comment=29246 Best regards. Quote Link to comment Share on other sites More sharing options...
eric Posted December 19, 2015 Author Share Posted December 19, 2015 Thanks DD . but i Dont know where to put this piece of code. Thx for help Eric Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2015 Share Posted December 19, 2015 Yes, I'm sorry, there is a problem with the cancellation of the event "selectionchange" when used with the "mousedown" event.. I will try analyze.. By the way, there are right way than I gave the link abovefor enable right click for the node selection: UniTreeview1 -> ClientEvents -> UniEvents ... [Ext.tree.Panel] beforeInit fn function beforeInit(sender, config) { sender.selModel = { ignoreRightMouseSelection: false } } Best regards. Quote Link to comment Share on other sites More sharing options...
eric Posted December 21, 2015 Author Share Posted December 21, 2015 hello DD, unfortunately i get the same issue. When trying to right click, the event UniTreeView1Change is not fired. ~eric Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 21, 2015 Share Posted December 21, 2015 Hi, For now, you can like this: 1. UniTreeview1 -> ClientEvents -> UniEvents ... [Ext.tree.Panel] beforeInit fn function beforeInit(sender, config) { sender.selModel = { ignoreRightMouseSelection: false } } 2. UniTreeview1 -> ClientEvents -> ExtEvents ... function itemmousedown(sender, record, item, index, e, eOpts) { if (e.button == 2){ function _showPopup() { ajaxRequest(sender.ownerCt, '_showPopup', ['x='+e.xy[0], 'y='+e.xy[1]]) } setTimeout(_showPopup, 200) } } 3. procedure TMainForm.UniTreeView1AjaxEvent(Sender: TComponent; EventName: string; Params: TStrings); begin if EventName = '_showPopup' then begin UniPopupMenu1.Popup(StrToInt(Params.Values['x']), StrToInt(Params.Values['y'])); end; end; 4. procedure TMainForm.UniTreeView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin //if Button=mbRight then // UniPopupMenu1.Popup(X, Y,unitreeview1); end; Try.. Best regards. Quote Link to comment Share on other sites More sharing options...
rgreat Posted December 22, 2015 Share Posted December 22, 2015 Still this: When trying to right click, the event UniTreeView1Change is not fired. Quote Link to comment Share on other sites More sharing options...
eric Posted January 5, 2016 Author Share Posted January 5, 2016 same error. UnitreevieeChange is not fired when right click. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 5, 2016 Share Posted January 5, 2016 Hi ! Ok, we will try analyze... Best regards. Quote Link to comment Share on other sites More sharing options...
rgreat Posted January 14, 2016 Share Posted January 14, 2016 This helped for me: function itemcontextmenu(sender, record, item, index, e, eOpts) { this.getSelectionModel().deselect(index) } Quote Link to comment Share on other sites More sharing options...
eric Posted September 18, 2018 Author Share Posted September 18, 2018 Hey DD, I used to use thgis piece of code with previous version. But not the event is not fired in 6.5. I got the following error . any idea ? eric Uncaught TypeError: Cannot read property '0' of undefined at _showPopup (eval at AjaxSuccess (ext-unicommon-min.js:9), <anonymous>:1:6708) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 18, 2018 Share Posted September 18, 2018 Hi, Sorry, can you make a simple testcase for this ?! Quote Link to comment Share on other sites More sharing options...
eric Posted September 18, 2018 Author Share Posted September 18, 2018 Here a sample project. I also noticed that the event beforeinit. dose not exist at all. thx eric Project1.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 19, 2018 Share Posted September 19, 2018 Hi, Sorry, I couldn't reproduce this Can you tell the sequence of your actions that lead to an error ?! Quote Link to comment Share on other sites More sharing options...
eric Posted September 19, 2018 Author Share Posted September 19, 2018 I am using the version 1.10.0.1472. ( I upgraded in 1.50.0.1480 and exactly the same issue) I go in the tree grid , on one of the items and right click. Then I get an error in debug mode in the browser. Thx eric fg 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.