Women in Technology

Hear us Roar



Article:
  Build a Dashboard Widget
Subject:   Widget does not work, I am working on a fix
Date:   2005-05-07 18:18:59
From:   aaanderson
I apologize but there is a problem with the Widget in the article. I originally wrote it and the article in a pre-release version of Tiger before Tiger was released. Unfortunately
I submitted the article before the release and never had the chance to test it in the final build.


The technical reason for the problem is that it looks like Apple changed the way that Dashboard handles the Widget.system method in the final release that makes the Widget not work.


I am sorry about this and understand everyone's frustration. I know people come to O'Reilly and MacDevCenter for reliable information and that this obviously is not up to par with what you expect. I am actively working on getting a fix together and I will post it as soon as possible.


yours,
Andrew

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Here is the fix!!
    2005-05-07 21:01:16  Andrew Anderson | [View]

    After messing with the code for a while, I determine the fix. The new code section is posted at the end of this message and I am working on getting it changed in the actual text of the article.

    The problem with the Widget is the way that the widget.system method in Javascript handles the path. In the pre-release versions included a certain set of default values for the path (i am unsure of the exact list), while the release version does not. This new version of the code handles the path and also insulates the values in the command via quoting to prevent any problems passing values.

    Thanks for everyones patience....

    Andrew

    Here is the complte code listing:


    <html>
    <head>
    <title>Dashboard Man Page</title>
    <meta http-equiv="Content-Type"
    content="text/html;charset=utf-8" >

    <style type="text/css">
    <!--
    .backStyle {
    position:absolute;
    width:400px;
    height:400px;
    left:0px;
    top:0px;
    z-index:0;
    visibility: visible;
    }

    .textStyle {
    font-family: Lucida Grande, Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #000000;
    position:absolute;
    width:111px;
    height:22px;
    z-index:1;
    left: 128px;
    top: 26px;
    }

    .inputStyle{
    position:absolute;
    width:123px;
    height:23px;
    z-index:1;
    left: 246px;
    top: 24px;
    visibility: visible;
    }

    .outputStyle{
    position:absolute;
    width:324px;
    height:400px;
    z-index:1;
    left: 33px;
    top: 72px;
    visibility: visible;
    }


    -->
    </style>
    <script type='text/javascript'>
    <!--
    // get man page
    function getManPage()
    {
    if (document.getElementById('programName').value != null)
    {
    var commandLine =
    'groff -mandoc -Tascii -P-b -P-c `/usr/bin/man -w "'
    + document.getElementById('programName').value+'"`'
    + ' | /bin/cat';
    var output = widget.system(commandLine, null);
    document.getElementById('outputArea').value = output.outputString;
    }
    }
    -->
    </script>

    </head>

    <body>
    <div id="BackgroundLayer" class="backStyle">
    <img src="Default.png" width="400" height="600">
    <div id="TextLayer" class="textStyle">
    <div align="right"> Get More Info On:</div>
    </div>
    </div>

    <div id="InputLayer" class="inputStyle">
    <input id="programName" type="text"
    size="14" border="0" height="23px" width="123px"
    onchange='getManPage();'>
    </input>
    </div>

    <div id="OutputLayer" class="outputStyle">
    <textarea id="outputArea" cols="42"
    rows="25" readonly>
    </textarea>
    </div>

    </body>
    </html>
    • Here is the fix!!
      2005-06-08 15:03:18  rayvanderver [View]

      Tried and still cannot get this to work. It shows nothing in the console and nothing on the output area.