Jump to content

Recommended Posts

Posted

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

Posted

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 above
for 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.

Posted

hello DD,

 

unfortunately i get the same issue.

When trying to right click, the event UniTreeView1Change is not fired.

 

~eric

Posted

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.

  • 2 weeks later...
  • 2 weeks later...
  • 2 years later...
Posted

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)

Posted

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

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...