Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Menu popping up below java applet (Read 2785 times)
jgreen
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 27
Joined: Aug 12th, 2010
Menu popping up below java applet
Aug 30th, 2010 at 9:39pm
Print Post  
Ok, next thing.

I have a 3rd party menu that pops up when I right click a node with various options.  All works well in Internet Explorer but in Chrome & Firefox, the menu displays below the diagram applet.   

Is there a way to force this not to happen?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Menu popping up below java applet
Reply #1 - Aug 31st, 2010 at 11:13am
Print Post  
You have a few options...

Use an IFrame shim to cover the applet and show the menu in it:
http://www.oratransplant.nl/2007/10/26/using-iframe-shim-to-partly-cover-a-java-...

Create menus using TableNodes:
http://mindfusion.eu/Forum/YaBB.pl?board=netdg_disc;action=display;num=125424382...

Or, handle nodeClicked from Java and use the Swing context menu class.

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


I love YaBB 1G - SP1!

Posts: 27
Joined: Aug 12th, 2010
Re: Menu popping up below java applet
Reply #2 - Aug 31st, 2010 at 3:42pm
Print Post  
Quote:
Use an IFrame shim to cover the applet and show the menu in it:

Tried this method already and didn't work.

Quote:
Create menus using TableNodes:

Tried this before as well and was buggy. Sometimes it appeared on top and sometimes below the shape. I assume I could try adding code to force it to the top but didn't like that it was just another shape and users could select it, drag it around, and link it to other shapes.

Quote:
Or, handle nodeClicked from Java and use the Swing context menu class.

No idea how to do this.
  
Back to top
 
IP Logged
 
jgreen
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 27
Joined: Aug 12th, 2010
Re: Menu popping up below java applet
Reply #3 - Aug 31st, 2010 at 9:33pm
Print Post  
ok, I gave the CreateTableNode method another shot and got it to where it will work.

What should have took several minutes took hours going through the "help" file and searching these forums for clues on how to do some of the things I wanted.

I REALLY WISH there were better help files available (with examples) especially in the javascript/java areas as there are no intellisense features to help give some clues.

To help prevent others the same agony, here's what I came up with.

Code
Select All
        var menu = null;
        function showContextMenu(node, mousePos)
        {

var dvApplet = document.getElementById("dgvMain");

        var scriptHelper = dvApplet.getScriptHelper();

        var diagView = dvApplet.getDiagramView();

        var diagram = diagView.getDiagram();



        if (!menu)

        {

            menu = diagram.getFactory().createTableNode(mousePos.getX(), mousePos.getY(), 60, 42.5);



            menu.setRowCount(7);


            menu.setColumnCount(2);


            menu.getCell(0, 0).setText("A");


            menu.getCell(1, 0).setText("Option A");


            menu.getCell(0, 1).setText("B");


            menu.getCell(1, 1).setText("Option B");


            menu.getCell(0, 2).setText("C");




            menu.getCell(1, 2).setText("Option C");


            menu.getCell(0, 3).setText("D");


            menu.getCell(1, 3).setText("Option D");


            menu.getCell(0, 4).setText("E");


            menu.getCell(1, 4).setText("Option E");


            menu.getCell(0, 5).setText("F");


            menu.getCell(1, 5).setText("Option F");


            menu.getCell(0, 6).setText("G");


            menu.getCell(1, 6).setText("Cancel");


        }


        var cols = menu.getColumns();


        cols.get(0).setWidth(6);


        menu.setCaptionHeight(0);


        menu.setCaption("");


        menu.setRowHeight(50);


        menu.setAllowIncomingLinks(false);


        menu.setAllowOutgoingLinks(false);


        menu.setCellFrameStyle(1); menu.getCell(0, 0).setTextFormat(scriptHelper.createTextFormat(1, 1, true, false));


        menu.getCell(0, 1).setTextFormat(scriptHelper.createTextFormat(1, 1, true, false));


        menu.getCell(0, 2).setTextFormat(scriptHelper.createTextFormat(1, 1, true, false));


        menu.getCell(0, 3).setTextFormat(scriptHelper.createTextFormat(1, 1, true, false));


        menu.getCell(0, 4).setTextFormat(scriptHelper.createTextFormat(1, 1, true, false));


        menu.getCell(0, 5).setTextFormat(scriptHelper.createTextFormat(1, 1, true, false));


        menu.getCell(0, 6).setTextFormat(scriptHelper.createTextFormat(1, 1, true, false));


        menu.setBrush(scriptHelper.createSolidBrush(255, 255, 255));


        menu.getCell(0, 0).setBrush(scriptHelper.createSolidBrush(200, 200, 200))


        menu.getCell(0, 1).setBrush(scriptHelper.createSolidBrush(200, 200, 200))


        menu.getCell(0, 2).setBrush(scriptHelper.createSolidBrush(200, 200, 200))


        menu.getCell(0, 3).setBrush(scriptHelper.createSolidBrush(200, 200, 200))


        menu.getCell(0, 4).setBrush(scriptHelper.createSolidBrush(200, 200, 200))


        menu.getCell(0, 5).setBrush(scriptHelper.createSolidBrush(200, 200, 200))


        menu.getCell(0, 6).setBrush(scriptHelper.createSolidBrush(200, 200, 200))


        menu.zTop();


    }

        else

        {


        menu.setVisible(true);


        menu.moveTo(mousePos.getX(), mousePos.getY());


        menu.zTop();


    }
        }
        function onClicked(sender, args) {
            hideMenu();
        }

        function onCellClicked(sender, args)
        {
            menu.setVisible(false);

            var mnuOpt = args.getRow();
            if (mnuOpt == 0) {
                curNode.setText(curNode.getText() + '\nOption A Selected');
            }
            if (mnuOpt == 1) {
                curNode.setText(curNode.getText() + '\nOption B Selected');
            }
            if (mnuOpt == 2) {
                curNode.setText(curNode.getText() + '\nOption C Selected');
            }
            if (mnuOpt == 3) {
                curNode.setText(curNode.getText() + '\nOption D Selected');
            }
            if (mnuOpt == 4) {
                curNode.setText(curNode.getText() + '\nOption E Selected');
            }
            if (mnuOpt == 5) {
                curNode.setText(curNode.getText() + '\nOption F Selected');
            }
            if (mnuOpt == 6) {
                //cancel
            }

        }


        function hideMenu() {
           if (menu)
            menu.setVisible(false);
        }
 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint