You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by tryfon <tr...@avl.com> on 2015/09/23 11:52:13 UTC

open context menu programmatically

i am creating an editor and and i would like to show a suggestion popup in a
textpane. My idea is  to show a context menu with "suggestions" after
pressing a keyboard combination(like eclipse Ctrl+Space).

Is there anyway to open context menu programmatically?

If someone has an other suggestion to implement this popup, i would like to
hear it.However I have to use textpane because i color the text.



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/open-context-menu-programmatically-tp4023022.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

RE: open context menu programmatically

Posted by Roger Whitcomb <Ro...@actian.com>.
Hi, welcome to Pivot!

Yes, there is.  In the tutorials section there are several tutorials on menus, including one on context menus (see here: http://pivot.apache.org/tutorials/context-menus.html).  This shows how to implement one using the standard right mouse click (by registering a MenuHandler with the component).  In order to use a key combination, you would have to register a key listener for the TextPane, then mimic what the right-click does (see the code in ApplicationContext.java around line 1000), which is basically to create an empty Menu object, then call the registered menu handler's "configureContextMenu" method (which you would implement).  So, pretty simple...

Feel free to contact us some more for more particulars, or if you are having problems.

HTH,
~Roger

-----Original Message-----
From: tryfon [mailto:tryfon.stergiou@avl.com] 
Sent: Wednesday, September 23, 2015 2:52 AM
To: user@pivot.apache.org
Subject: open context menu programmatically

i am creating an editor and and i would like to show a suggestion popup in a textpane. My idea is  to show a context menu with "suggestions" after pressing a keyboard combination(like eclipse Ctrl+Space).

Is there anyway to open context menu programmatically?

If someone has an other suggestion to implement this popup, i would like to hear it.However I have to use textpane because i color the text.



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/open-context-menu-programmatically-tp4023022.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


RE: open context menu programmatically

Posted by Roger Whitcomb <Ro...@actian.com>.
Nice!

-----Original Message-----
From: tryfon [mailto:tryfon.stergiou@avl.com] 
Sent: Thursday, September 24, 2015 2:49 AM
To: user@pivot.apache.org
Subject: Re: open context menu programmatically

Finally i created a dialog and i removed the title bar...



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/open-context-menu-programmatically-tp4023022p4023023.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: open context menu programmatically

Posted by tryfon <tr...@avl.com>.
Finally i created a dialog and i removed the title bar...



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/open-context-menu-programmatically-tp4023022p4023023.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.