open context menu programmatically

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

open context menu programmatically

tryfon
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.
Reply | Threaded
Open this post in threaded view
|

Re: open context menu programmatically

tryfon
Finally i created a dialog and i removed the title bar...
Reply | Threaded
Open this post in threaded view
|

RE: open context menu programmatically

Roger Whitcomb-2
In reply to this post by tryfon
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:[hidden email]]
Sent: Wednesday, September 23, 2015 2:52 AM
To: [hidden email]
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.

Reply | Threaded
Open this post in threaded view
|

RE: open context menu programmatically

Roger Whitcomb-2
In reply to this post by tryfon
Nice!

-----Original Message-----
From: tryfon [mailto:[hidden email]]
Sent: Thursday, September 24, 2015 2:49 AM
To: [hidden email]
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.