PaulANormanNZ
unread,Oct 14, 2011, 8:47:27 PM10/14/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to GLUEscript
Hi,
When you're doing something like ...
var factory = new net.HTTPRequestHandlerFactory();
factory.createRequestHandler = function(request)
{
var handler = new
net.HTTPRequestHandler();
handler.handleRequest =
function(request, response)
{
// doing something at this level
}
glue.server = new net.HTTPServer(factory, new
net.ServerSocket(glueServerSocket), new net.HTTPServerParams());
glue.server.start();
And you are making a desktop type app in the browser (great
advantages) that uses server calls,and you want wxwidgets to appear
from within the type of area shown above, is there a stable way of
using top level functions like:
myWx = require("wx");
I've tried
myWx = glue.require("wx");
And
myWx.messageBox("hello from deep function"); works fine, but does not
come to front of screen.
This works ... but
Is it correct/stable, in strict ECMA I expect it to be.
Also, can there be more than one wx object that calls ...
myWx.theApp.onInit = function(){}
... Per / script?
Or are we limited to one object only per script being able to use
dahDah.theApp.onInit = dahdaH
Specifically I have a switch statement which acts on the server
request information, here is a segment. I have run the contents of the
case statement below as a standalone GLUEscript and it works fine -
changing/removing " response. " as appropriate.
case 'navigate':
//response.contentType="text/plain";
//response.print("List Will be here");
// above response(s) test fine
var wxImagDir = glue.require("wx");
wxImagDir.initAllImageHandlers();
wxImagDir.theApp.onInit = function(){ // none of this seems to work
var simple = new wxImagDir.Frame(null, wxImagDir.Id.ANY, "Choose
Directory");
var panel = new wxImagDir.Panel(simple, wxImagDir.Id.ANY);
var button = new wxImagDir.Button(panel, wxImagDir.Id.ANY,
"Choose Image Directory", { x : 40, y : 50 });
var buttonClose = new wxImagDir.Button(panel, wxImagDir.Id.EXIT, "",
{ x : 290, y : 180 });
var showText = new wxImagDir.StaticText(panel, wxImagDir.Id.ANY, "",
{ x : 20, y : 20 });
showText.wrap = 200;
showText.label = "Please Choose The Directory You Wish to Work
with:";
button.onClicked = function(){
var getDir = new wxImagDir.DirDialog(simple,
"Choose Image Directory",
"",
wxImagDir.DirDialog.DEFAULT_STYLE,
wxImagDir.DefaultPosition); //
getDir.showModal();
glue.getDir = getDir;
simple.close();
}
buttonClose.onClicked = function(){
simple.close();
}
simple.center();
simple.visible = true;
return true;
}
response.contentType="text/plain";
response.print(glue.getDir.path); // as theApp.onInit does not appear
to fire, this: TypeError: glue.getDir is undefined
wxImagDir.messageBox("hello from deep function"); // works fine if
above line REMed out, but does not come to front of screen
break;
Paul