PDA

View Full Version : Question on impllementing help system for GXT application



NotChris
16 Dec 2011, 11:23 AM
We have an application where we would like to launch help from a menu and also be able to enter F1 to bring up context sensitive help based on the current screen or dialog. I am being given a .dna file in addition to a number of other help files. The .dna file determines which help file to call based on providing the correct context. Is GXT setup to handle this and if so, what would I need to do to have this work? I have tried to search for "help", "help content", "help file", "dna", "implementing help", etc on help in the forum and have had no luck. If there is already a topic that covers this, please point me to it.

Thank you.

mjack003
9 Jan 2012, 12:43 PM
NotChris,

As far as I know, GXT does not contain structure to support help systems out of the box. However, we've built our own "function" key setup to replicate the existing desktop ERP's hotkeys for the company I work for. With our help system (F1), we just use native javascript to capture the event (valid parts included below..just fill in the Keyhandler_Meta actions), use the event source to build the help context, pass that to a servlet to build the help URL, and then open a window on the UI with the returned URL. Our help documentation is written in a wiki though which makes this setup easy to use.



//Native JS to capture function keys
protected native void setupFunctionKeys() /*-{

$doc.onkeydown = function(e) { __handleKeys(e); }
$doc.onkeypress = function(e) { __handleKeys(e); }
$doc.onhelp = function() {return(false);}
$wnd.onhelp = function() {return(false);}

var nonChar = false;
var Combo = false;
function __handleKeys(e) {
isScrolling = false;
ScrollingX = false;
ScrollingY = false;

var character;
var evt = (e) ? e : window.event; //IE reports window.event not arg

if (!evt.stopPropagation) {
evt.stopPropagation = function() { this.cancelBubble = true; };
evt.preventDefault = function() { this.returnValue = false; };
}

if (!evt.stop) {
evt.stop = function() {
this.stopPropagation();
this.preventDefault();
};
}

if (evt.ctrlKey && evt.keyCode == 9) {
if (evt.type == "keypress")
Editor.fireOnCtrlTab(evt.shiftKey);
evt.stop();
evt.returnValue = false;
return false;
}

if (evt.type == "keydown") {
character = evt.keyCode;
if (
(character >= 112 && character <= 123) // F1 to F12
) {
nonChar = true;
Keyhandler_Meta(character, evt, e); // function to handle non Characters
} else {
nonChar = false;
}
}
}

function Keyhandler_Meta(Meta, evt, e)
{
if (!evt.kill)
{
evt.kill = function()
{
if (e == undefined) evt.keyCode = false; //Kill IE6+7
evt.stop();
evt.returnValue = false;
}
}
switch (Meta)
{
case 112: //F1
case 113: //F2
case 114: //F3
case 115: //F4
case 116: //F5
case 117: //F6
case 118: //F7
case 119: //F8
case 120: //F9
case 121: //F10
case 122: //F11
case 123: //F12
evt.kill();
break;
default:
break;
}
return true;
}
}-*/;

Hope that helps.

Mjack