Lisp HUG Maillist Archive

How do you handle a right click on a capi:tree-view?

Hi

subject says it all.  It does not look like I can do it.  (Of course I 
feel this is a bad case of RTFM, but I thought I'd ask)

I want to pop up a menu on the right clicking an item in the tree-view.

Thanks

Marco


--
Marco Antoniotti					http://bioinformatics.nyu.edu
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.


Re: How do you handle a right click on a capi:tree-view?

Unable to parse email body. Email id is 3219

RE: How do you handle a right click on a capi:tree-view?

> Subject: Re: How do you handle a right click on a capi:tree-view?
 
> Yes, chapter 7 of the CAPI User Guide.
> 
> (defun marco-menu (pane data x y) 
>        (make-instance 'capi:menu :items 
>        (list "Hi" 
>              "Marco" 
> 	     "See 
> http://www.lispworks.com/reference/lw44/CAPUG-W/html/capiuser-
> w-82.htm")))
> 
> (capi:contain 
>   (make-instance 'capi:tree-view 
>                  :pane-menu 'marco-menu 
>                  :roots '(1 2 3)))

That's great. I've been wanting it for ages but didn't know it
existed.

With this...

(defun marco-menu (pane data x y) 
  (make-instance 'capi:menu
                 :items (list "Hi" 
                              "Marco"
                              data)))

(capi:contain
  (make-instance 'capi:tree-view 
                 :pane-menu 'marco-menu 
                 :roots '(1 2 3)))

.... the pane menu includes something that depends on which item
was clicked on.

But if I use a CAPI:LIST-PANEL instead of a CAPI:TREE-VIEW...

(capi:contain 
  (make-instance 'capi:list-panel
                 :pane-menu 'marco-menu 
                 :items '(1 2 3)))

.... the DATA argument to MARCO-MENU always has a value of NIL.
Is that a bug?

(Using LWW 4.3.7.)



Re: How do you handle a right click on a capi:tree-view?

Unable to parse email body. Email id is 3227

RE: How do you handle a right click on a capi:tree-view?

>  > With this...
>  > 
>  > (defun marco-menu (pane data x y) 
>  >   (make-instance 'capi:menu
>  >                  :items (list "Hi" 
>  >                               "Marco"
>  >                               data)))
>  > 
>  > (capi:contain
>  >   (make-instance 'capi:tree-view 
>  >                  :pane-menu 'marco-menu 
>  >                  :roots '(1 2 3)))
>  > 
>  > ... the pane menu includes something that depends on which item
>  > was clicked on.
>  > 
>  > But if I use a CAPI:LIST-PANEL instead of a CAPI:TREE-VIEW...
>  > 
>  > (capi:contain 
>  >   (make-instance 'capi:list-panel
>  >                  :pane-menu 'marco-menu 
>  >                  :items '(1 2 3)))
>  > 
>  > ... the DATA argument to MARCO-MENU always has a value of NIL.
>  > Is that a bug?
> 
> Yes, thanks for reporting it. We'll look into fixing it.
> 
> The other way of specifying a popup menu is more powerful and I
think
> you could use it to get the functionality you want.

Hmmm, I'm not sure. The other way of specifying a popup menu
seems to have no way of knowing which item was the subject
of a right-click.

Or am I missing something?

To expand on the above:

Right-clicking doesn't change the selection. After right clicking
an item that is not the selection it initially looks as though
the selection has changed, but after the menu is dismissed the
selection highlighting reverts to the real selection.

Well, that's true for the tree view, and the value of DATA in
MARCO-MENU is the item that was clicked on.
(The write-up in the CAPI User Guide is confusing because it says
that DATA is "the selected object if there is a selection".)

However, for the list-panel right-clicking an item that is not the
selection does not change the highlighting in the same way.

BTW, I think the tree view is doing The Right Thing.

Simon



RE: How do you handle a right click on a capi:tree-view?

I wrote:
> Right-clicking doesn't change the selection. After right clicking
> an item that is not the selection it initially looks as though
> the selection has changed, but after the menu is dismissed the
> selection highlighting reverts to the real selection.

Rather than "after the menu is dismissed", I meant to say
"after a menu item is chosen".

The same observation holds if the menu is "dismissed" by clicking
away from it, but that's not what I was trying to say.

Simon



Re: How do you handle a right click on a capi:tree-view?

Unable to parse email body. Email id is 3230

Updated at: 2020-12-10 08:54 UTC