Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
User interface 三便士Gui-将Javascript文件插入HTML标头,但失败<;脚本>;实施_User Interface_Haskell_Threepenny Gui - Fatal编程技术网

User interface 三便士Gui-将Javascript文件插入HTML标头,但失败<;脚本>;实施

User interface 三便士Gui-将Javascript文件插入HTML标头,但失败<;脚本>;实施,user-interface,haskell,threepenny-gui,User Interface,Haskell,Threepenny Gui,我正在使用三便士GUI实现图形数据库的前端。为了节省时间,我希望在GUI显示页面中使用已经构建的面向JavaScriptjQuery的代码文件。我使用Mac上的FireFox浏览器来检查html代码 尝试包含画布相关元素时出现一两个问题 尚未编写任何函数将Javascript源代码包含到显示的HTML页面标题中 我通过阅读一些三便士来源来解决这个问题,以确定如何制定自己的程序。借用addStyleSheet的函数定义作为模型,将代码复制到源代码中进行测试: UI.addStyleSheet ro

我正在使用三便士GUI实现图形数据库的前端。为了节省时间,我希望在GUI显示页面中使用已经构建的面向JavaScriptjQuery的代码文件。我使用Mac上的FireFox浏览器来检查html代码

尝试包含画布相关元素时出现一两个问题

尚未编写任何函数将Javascript源代码包含到显示的HTML页面标题中

我通过阅读一些三便士来源来解决这个问题,以确定如何制定自己的程序。借用addStyleSheet的函数定义作为模型,将代码复制到源代码中进行测试:

UI.addStyleSheet rootWindow "gui_fmiq.css"
-- the following code does the above and works in this context --
el <- mkElement "link"
    # set (attr "rel" ) "stylesheet"
    # set (attr "type") "text/css"
    # set (attr "href") ("/static/css/gui_fmiq.css")
getHead rootWindow #+ [element el]
UI.addStyleSheet根窗口“gui_fmiq.css”
--下面的代码执行上述操作,并在此上下文中工作--

我还没来得及检查,不幸的是,把元素添加到身体而不是头部会有帮助吗?这似乎是现在在页面加载后包含脚本的标准过程。是的,我在检查了大量脚本示例后意识到了这一点。现在唯一的问题是如何在按下按钮时发送画布的图形内容。我无法直接调用javascript——与Threepenny库的类型冲突太多。我想从html页面发送一个PNG或JPG ByTestStream到Haskell进行进一步处理,而不是使用数据在浏览器中打开一个窗口(这是死板的标准做法)。
inc_sketchScript <- mkElement "script"
    # set (attr "src") "/static/sketch.js"
getHead rootWindow
    #+ [
        element inc_sketchScript
       ]
    canvas <- UI.canvas
    # set UI.height canvasHeight
    # set UI.width  canvasWidth
    # set style [("border", "solid black 1px"), ("background", "#eee")]
    # set UI.id_ "simple_sketch"
    #+ [
        mkElement "script"
            # set (attr "type") "text/javascript"
            # set text "$(function() {$('simple_sketch').sketch(); });"
       ]