Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Invoke context menu (Read 7219 times)
ESKO
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Jan 27th, 2014
Invoke context menu
Jan 27th, 2014 at 9:34am
Print Post  
I wanna ask how can I invoke context menu by holding finger on diagramView?
I tried this:
Code (Java)
Select All
diagramView.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){

			@Override
			public void onCreateContextMenu(ContextMenu menu, View v,
					ContextMenuInfo menuInfo) {
				MenuItem arrange = menu.add(Menu.NONE, 0, 0, "Arrange diagram");

			}

		});
		 


but this doesn't work Undecided
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Invoke context menu
Reply #1 - Jan 27th, 2014 at 11:17am
Print Post  
Our guess is this does not work because DiagramView intercepts long clicks to toggle selection and the base View doesn't ever get to create a context menu. Our developer will try to add support for context menus in the next couple of days.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Invoke context menu
Reply #2 - Jan 28th, 2014 at 9:04pm
Print Post  
This version should display the context menu upon a long press:
https://mindfusion.eu/_beta/droiddiag_ctxmenu.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
ESKO
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Jan 27th, 2014
Re: Invoke context menu
Reply #3 - Jan 29th, 2014 at 5:58pm
Print Post  
thanks  Smiley
  
Back to top
 
IP Logged
 
reedm60
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 31st, 2018
Re: Invoke context menu
Reply #4 - Oct 31st, 2018 at 8:11pm
Print Post  
Does anyone know how to create a context menu that comes up when a user (long) touches a diagram item?  The documentation talks about handling the onContextMenuOpening event but I don't know how to do that.

Thanks!
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3148
Joined: Oct 19th, 2005
Re: Invoke context menu
Reply #5 - Oct 31st, 2018 at 8:42pm
Print Post  
Hi,

Check the "Controls" sample project, it shows custom context menu like this -

Code
Select All
diagramView.getDiagram().addDiagramListener(new DiagramAdapter()
{
	@Override
	public void contextMenuOpening(RadialMenuEvent e)
	{
		final DiagramItem diagramItem = e.getItem();
		e.getMenu().addMenuItem(R.drawable.square1,
			new MenuItemListener()
			{
				public void onTouchUp(MenuItemEvent e)
				{
					if (diagramItem instanceof ShapeNode)
					{
						ShapeNode node = (ShapeNode)diagramItem;
						node.setShape(Shape.fromId("Rectangle"));
					}
				}
			});
		e.getMenu().addMenuItem(R.drawable.circle1,
			new MenuItemListener()
			{
				public void onTouchUp(MenuItemEvent e)
				{
					if(diagramItem instanceof ShapeNode)
					{
						ShapeNode node = (ShapeNode)diagramItem;
						node.setShape(Shape.fromId("Ellipse"));
					}
				}
			});
	}
}); 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
reedm60
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 31st, 2018
Re: Invoke context menu
Reply #6 - Oct 31st, 2018 at 8:47pm
Print Post  
Thank you!!!
  
Back to top
 
IP Logged
 
reedm60
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 31st, 2018
Re: Invoke context menu
Reply #7 - Oct 31st, 2018 at 9:57pm
Print Post  
Is there any way to replace the Radial style menu with a standard looking textual popup menu?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3148
Joined: Oct 19th, 2005
Re: Invoke context menu
Reply #8 - Nov 1st, 2018 at 8:56am
Print Post  
Try calling RadialMenuEvent.setCancel(true) to prevent the radial menu from popping up, and then show whatever other UI you prefer.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
reedm60
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Oct 31st, 2018
Re: Invoke context menu
Reply #9 - Nov 1st, 2018 at 3:15pm
Print Post  
Thanks again.  I can see from decompiling the DiagramView code that calling setCancel() on the RadialMenuEvent will definitely keep it from displaying.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint