Focal Point
[CASE-OPENED] Active Report - How to Turn Off Context Menu Upon Click Within Report.

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9497052706

July 22, 2011, 09:44 AM
David Briars
[CASE-OPENED] Active Report - How to Turn Off Context Menu Upon Click Within Report.
How can I turn off the Context Menu that appears within an Active Report, upon clicking a cell?

Below is some code that 'turns off' the menu, by displaying an Alert Box. It appears that the Alert Box supercedes the popup Context Menu.

  
-******************************************************************************
-* Focexec     : CheckProto
-* Purpose     : Checkbox Prototype - Support Checkboxes within AHTML.
-* Author      : D. Briars
-* Date Written: 07/21/11
-* Revisor     :
-* Date Revised:
-* Comments    : None.  
-* Inputs      : GGPRODS - IBI Test File.
-* Output      : AHTML 
-* Parms       : None.
-******************************************************************************
-** Set up environment.
-******************************************************************************
APP PREPENDPATH IBISAMP
-RUN
-******************************************************************************
-** Create AHTML/Checkboxes.
-******************************************************************************
DEFINE FILE GGPRODS
 CHK_BOX/A100 = '<input type="checkbox" value="CBX' || PRODUCT_ID || '"' ||
                ' onclick="donothing()"'  ||
                '>';
END
-*
TABLE FILE GGPRODS
PRINT PRODUCT_ID
      CHK_BOX AS ''       
      PRODUCT_DESCRIPTION
ON TABLE HOLD AS ACTREPT FORMAT AHTML
ON TABLE SET STYLE *
     INCLUDE = nfa,
$
-* Set lines per page, and location of paging object.
 TYPE=REPORT,
-*      FONT='ARIAL', SIZE=11,
-* Show all results on one page.
      LINES-PER-PAGE=UNLIMITED,
	  OBJECT=STATUS-AREA,
-* Turn off pagination bar.
	  PAGE-LOCATION=OFF,
	  JUSTIFY=CENTER,$
ENDSTYLE
END
-RUN
-******************************************************************************
-** Display HTML/AHTML Reports.
-******************************************************************************
-HTMLFORM BEGIN
<html>
<head>
<title>Multi Checkboxes</title>
<script language=javascript>
//
// Function: donothing 
// Purpose : Attempts to remove row selected context menu, upon row click.  
//
function donothing() {
// my_window = window.open("",
//       "mywindow","status=1,width=350,height=150");
// my_window.document.write('<h1>The Popup Window</h1>');
// my_window.close();
//
 alert("Note that Context Menu, does not appear.");
//
//document.getElementById("dummy").click();
//document.getElementById("dummy").focus();
//document.getElementById("dummy").blur();
}
//
// Function: CheckAllCheckNone
// Purpose : Check all/Uncheck all Checkboxes, upon button click.
//
function CheckAllCheckNone(toggle) {

    var elLength = document.MyForm.elements.length;

    for (i=0; i < elLength; i++)
    {
        var type = MyForm.elements[i].type;
        var position = MyForm.elements[i].value.indexOf("CBX");
        if (type=="checkbox" && position >= 0 && (toggle)) {
            MyForm.elements[i].checked = "checked";
        }
        else if (type=="checkbox" && position >= 0 && !(toggle)) {
            MyForm.elements[i].checked = "";
        }
        else {
        }
    }
}
//
// Function: CheckCheckBoxes
// Purpose : Scroll through checkboxes, creating an array of Product Id's, for each
//           slected checkbox box.
//
function CheckCheckboxes(){
    var elLength = document.MyForm.elements.length;
    var aryCheckBoxes = new Array();
    var cntrCheckBoxes = 0

    for (i=0; i < elLength; i++)
    {
        var type = MyForm.elements[i].type;
        var position = MyForm.elements[i].value.indexOf("CBX");

        if (type=="checkbox" && MyForm.elements[i].checked && position >= 0){
            aryCheckBoxes[cntrCheckBoxes] = MyForm.elements[i].value.substr(3,4);
            cntrCheckBoxes++
        }
        else {
        }
    }

    var holdit = "Array of Product Id(s): "
    for (i=0; i < aryCheckBoxes.length; i++)
    {
      holdit = holdit + ' ' + aryCheckBoxes[i];
    }
    alert(holdit);
}
</script>
</head>
-*
<body>
<form name="MyForm">
-* Insert active report.
!IBI.FIL.ACTREPT;
-* Display buttons.
<input value="Get Values"  type="button" onClick="CheckCheckboxes();">
<br><br>
<input value="Reset" type="reset">
<br><br>
<input value="Select All" type=button onclick="CheckAllCheckNone(true);">
<br><br>
<input value="Unselect All" type=button onclick="CheckAllCheckNone(false);">
<br><br>
<input value="Dummy" type="button" name="dummy" id="dummy">
-*
</form>
</body>
</html>
-HTMLFORM END

This message has been edited. Last edited by: Kerry,




Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
July 22, 2011, 10:09 AM
David Briars
Normal Active Report behaviour: Upon the mouse moving off of the menu, the menu disappears.

If we can find out what code is triggered upon this event (onMouseOut?), I could perhaps call it, when my checkbox is clicked.
July 27, 2011, 04:02 PM
Kerry
FYI, David already has a case opened regarding this issue.

David, if you have an update/solution from the case, can you please post here? Thank you in advance for sharing with all.

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
July 27, 2011, 05:12 PM
Enigma006
this doesn't work for me as well.
I manually click somewhere on the screen to get the menu off the screen. moving mouse off the menu doesn't work..!


8.1.05
HTML,PDF,EXL2K, Active, All
July 27, 2011, 06:00 PM
David Briars
quote:
David, if you have an update/solution from the case, can you please post here?

Will do.
August 09, 2011, 09:56 AM
David Briars
Calling the JavaScript function hidemenu, upon the mouse click, will hide the pop up context menu, per my case with IB support.

-******************************************************************************
-* Focexec     : CheckProto
-* Purpose     : Checkbox Prototype - Support Checkboxes within AHTML.
-* Author      : D. Briars
-* Date Written: 07/21/11
-* Revisor     :
-* Date Revised:
-* Comments    : None.
-* Inputs      : GGPRODS - IBI Test File.
-* Output      : AHTML
-* Parms       : None.
-******************************************************************************
-** Set up environment.
-******************************************************************************
APP PREPENDPATH IBISAMP
-RUN
-******************************************************************************
-** Create AHTML w/ Checkboxes.
-******************************************************************************
DEFINE FILE GGPRODS
 CHK_BOX/A100 = '<input type="checkbox" value="CBX' || PRODUCT_ID || '"' ||
                ' onclick="RemoveMenu()"'  ||
                '>';
END
-*
TABLE FILE GGPRODS
PRINT PRODUCT_ID
      CHK_BOX AS ''
      PRODUCT_DESCRIPTION
ON TABLE HOLD AS ACTREPT FORMAT AHTML
ON TABLE SET STYLE *
     INCLUDE = nfa,
$
-* Set lines per page, and location of paging object.
 TYPE=REPORT,
-* Show all results on one page.
      LINES-PER-PAGE=UNLIMITED,
	  OBJECT=STATUS-AREA,
-* Turn off pagination bar.
	  PAGE-LOCATION=OFF,
	  JUSTIFY=CENTER,$
ENDSTYLE
END
-RUN
-******************************************************************************
-** Display AHTML Report.
-******************************************************************************
-HTMLFORM BEGIN
<html>
<head>
<title>Multi Checkboxes</title>
<script language=javascript>
//
// Function: Remove Menu
// Purpose : Removes row selected context menu, upon checkbox click.
//
function RemoveMenu() {
 var t=setTimeout("hidemenu();",5);
}
//
// Function: CheckAllCheckNone
// Purpose : Check all/Uncheck all Checkboxes, upon button click.
//
function CheckAllCheckNone(toggle) {

    var elLength = document.MyForm.elements.length;

    for (i=0; i < elLength; i++)
    {
        var type = MyForm.elements[i].type;
        var position = MyForm.elements[i].value.indexOf("CBX");
        if (type=="checkbox" && position >= 0 && (toggle)) {
            MyForm.elements[i].checked = "checked";
        }
        else if (type=="checkbox" && position >= 0 && !(toggle)) {
            MyForm.elements[i].checked = "";
        }
        else {
        }
    }
}
//
// Function: CheckCheckBoxes
// Purpose : Scroll through checkboxes, creating an array of Product Id's, for each
//           slected checkbox box.
//
function CheckCheckboxes(){
    var elLength = document.MyForm.elements.length;
    var aryCheckBoxes = new Array();
    var cntrCheckBoxes = 0

    for (i=0; i < elLength; i++)
    {
        var type = MyForm.elements[i].type;
        var position = MyForm.elements[i].value.indexOf("CBX");

        if (type=="checkbox" && MyForm.elements[i].checked && position >= 0){
            aryCheckBoxes[cntrCheckBoxes] = MyForm.elements[i].value.substr(3,4);
            cntrCheckBoxes++
        }
        else {
        }
    }

    var holdit = "Your selected Product Codes: "
    for (i=0; i < aryCheckBoxes.length; i++)
    {
      holdit = holdit + ' ' + aryCheckBoxes[i];
    }
    alert(holdit);
}
</script>
</head>
-*
<body>
<form name="MyForm">
-* Insert active report.
<table>
 <tr>
  <td> &|nbsp &|nbsp </td>
  <td> !IBI.FIL.ACTREPT; </td>
 </tr>
</table>
-* Display buttons.
&|nbsp <input value="Get Values"  type="button" onClick="CheckCheckboxes();">
&|nbsp <input value="Reset" type="reset">
&|nbsp <input value="Select All" type=button onclick="CheckAllCheckNone(true);">
&|nbsp <input value="Unselect All" type=button onclick="CheckAllCheckNone(false);">
-*
</form>
</body>
</html>
-HTMLFORM END





Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
March 03, 2017, 02:29 PM
Teri Newton
I know this is an old post, but I am looking for the same thing. I do not want the context menu when the user clicks on a checkbox in the report. My initial solution was to use HTML format rather than AHTML, but the users want the active report features like sort, export, and send.

I tried the example posted, but still get the context menu.



I can hide "Comments" in the stylesheet, but none the other options will get rid of "Hightlight Value", "Hight Row", "Unhighlight All", or "Filter Cell".

TYPE=REPORT, ALLOW-COMMENTS=OFF, $ 




March 06, 2017, 04:32 PM
David Briars
When I run the sample code now (Release 8105M) I see the following JavaScript error:
SCRIPT5009: 'hidemenu' is undefined
File: eval code (9), Line: 1, Column: 1   

I am guessing that while the 'hidemenu' function, IB provided to me in the case, was available in my release at the time (7.x), at some point it was no longer exposed.

You might want to ask IB if there is an update to this case, or an alternative.
March 29, 2017, 01:17 PM
Teri Newton
I figured it out!

The table is calling cellmenu.

<table class="arGrid" onclick="cellmenu();" onmouseout="curCell.tablenumber=-1;" bgcolor="white" id="IWindowBody0" cellpadding="0" cellspacing="0" border="0">


So I tricked it by creating a cellmenu function that does nothing and placed it at the end of the report.

-HTMLFORM BEGIN
<script>
function cellmenu() {
}
</script>
-HTMLFORM END

March 29, 2017, 01:21 PM
Francis Mariani
Good for you! That's the currently accepted workaround.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 08, 2018, 02:54 PM
David Briars
quote:
..So I tricked it by creating a cellmenu function that does nothing and placed it at the end of the report...

Thank you Teri.

This technique is working fine for me in 8105M.




Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster