You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by gdeshors <g....@laposte.net> on 2012/06/21 17:07:21 UTC

Context menu on a Tab Pane

Hi

I'm trying to create a context menu on a tab pane : right-click on the title
of the pane and you get a menu *that depends on the tab you clicked*. Think
of Firefox, for example, where you can right-click, choose "close tab" and
it closes the tab you chose.

I managed to create a menu, but am unable to find a way to know which tab
has been clicked. If I call getSelectedIndex on my TabPane, it works if the
pane is already selected, but returns the /previous/ selected pane if you
click on an unselected pane.

Is there a good way of achieving this ?

Thanks in advance.
Guillaume

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Context-menu-on-a-Tab-Pane-tp4021914.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

RE: Context menu on a Tab Pane

Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
In looking through the existing JIRA issues for Pivot, it looks like
there is an issue that would address your use case:  Pivot-592
(http://issues.apache.org/jira/browse/PIVOT-592), which has not been
resolved yet....

~Roger Whitcomb

-----Original Message-----
From: gdeshors [mailto:g.deshors@laposte.net] 
Sent: Friday, June 22, 2012 6:55 AM
To: user@pivot.apache.org
Subject: Re: Context menu on a Tab Pane

Hi

Thanks for your answer. I had tried, as in the context menu tutorial :

I also tried getComponentAt, I tried to call these methods on my tabpane
rather than the window or the direct container, but it didn't help in
any case. The problem I have is that the components of the tab bar get
created automatically and I can't find a link betwwen them and the
actual tab below, or simply know the index of the tab.

I also tried to replace the tabData with a personalised object, but the
menuHandler doesnt do anything in this case, I would say it gets removed
by the tabPane when it creates the listeners.


I didn't do any progress !
Thanks
Guillaume

--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/Context-menu-on-a-Tab-Pan
e-tp4021914p4021918.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Context menu on a Tab Pane

Posted by Sandro Martini <sa...@gmail.com>.
A quick info:
for some example of MenuHandler usage, take a look at the tests
subproject (for example search setMenuHandler), maybe you can find
something useful.

Bye

Re: Context menu on a Tab Pane

Posted by Sandro Martini <sa...@gmail.com>.
Hi,
sorry for the delay ...

At this point I don't know if there is a solution to your use case,
maybe others of us could have some idea.

As a general idea, could you try to traverse all components of your
container (should be possible using the iterator() method), and for
any component check coordinates to see if they match with yours ?

As a sample look at: SheetSlideDirectionWindow under examples.
Then look at Component api ...

Keep us updated.

Bye,
Sandro

Re: Context menu on a Tab Pane

Posted by gdeshors <g....@laposte.net>.
Hi

Thanks for your answer. I had tried, as in the context menu tutorial :

I also tried getComponentAt, I tried to call these methods on my tabpane
rather than the window or the direct container, but it didn't help in any
case. The problem I have is that the components of the tab bar get created
automatically and I can't find a link betwwen them and the actual tab below,
or simply know the index of the tab.

I also tried to replace the tabData with a personalised object, but the
menuHandler doesnt do anything in this case, I would say it gets removed by
the tabPane when it creates the listeners.


I didn't do any progress !
Thanks
Guillaume

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Context-menu-on-a-Tab-Pane-tp4021914p4021918.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Context menu on a Tab Pane

Posted by Sandro Martini <sa...@gmail.com>.
Hi,
try to get a reference to the component under the current coordinates
... in mailing lists and in source code you should find many samples
of this

Sorry for a so quick response, but I'm really in hurry now.

Keep us updated, and post here if you need more help.

Bye,
Sandro