MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help with ScriptSource in GUIKit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98602] Re: Help with ScriptSource in GUIKit
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Tue, 14 Apr 2009 06:14:52 -0400 (EDT)
  • References: <grpi8i$lgi$1@smc.vnet.net>

Paul Ellsmore wrote:
> Anyone out there familiar with GUIKit?
> 
> Here is a simple GUI that Prints "Clicked" when you push the button. 
> 
> In[1829]:=
> 
> ref = GUIRun[Widget["Button", {"text" -> "Update", BindEvent["action",
> Script[{Print["Clicked"]}]]}], 
> 
>     IncludedScriptContexts -> {$Context}];
> 
> I want the button to execute a large block of code, and the GUIKit
> documentation suggests I use the ScriptSource function:
> 
> In[1827]:=
> 
> Needs["GUIKit`"]; 
> 
> ref = GUIRun[Widget["Button", {"text" -> "Update", BindEvent["action",
> Script[{}, ScriptSource -> "targetNB.m"]]}], 
> 
>     IncludedScriptContexts -> {$Context}]; 
> 
> In this test case, targetNB.m just has the code Print["Clicked"] in it.
> Nothing happens when I click the button, no error message, no "clicked" gets
> printed. I have put the GUI notebook and the targetNB.m file in the same
> folder, and set Directory to that folder. The documentation for ScriptSource
> is appalling (no surprise there), but I assume that the contents of
> targetNB.m will effectively be pasted into the Script function. Is this too
> naive?
> 
> Note that if I specify a non-existent m file for ScriptSource, I get no
> error message. Am I doing something clearly dumb? Is there a better way to
> make some GUI "action" run a separate notebook or m file?
> 
> BTW, I realise that GUIKit is (pretty much) obsolete, and I will be (am, in
> parallel) developing a V7 GUI from built-in code, but we have a lot of
> legacy V5 notebooks, and GUIKit is actually a pretty easy way to interface
> with them (apart from little issues like this one!).
> 
> Thanks,
> 
> Paul.
> 
> Dr. Paul A. Ellsmore
> 
>  
> 
> Nanion Limited
> 
> Oxford Centre for Innovation
> 
> Mill Street
> 
> Oxford
> 
> United Kingdom
> 
> OX2 0JX
> 
>  
> 
> Tel: +44 (0) 1865 811175
> 
> Fax: +44 (0) 1865 248594
> 
>  
> 
> 

As I mentioned elsewhere, I suggest you try my (free) Super Widget 
Package to create Java GUI's. I used to base this software on GUIKit, 
but after a while, I got tired of all the obscure problems that GUIKit 
constantly threw up, and moved to a direct J/Link plus compiled Java 
implementation.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: converting a list element into a number?
  • Next by Date: Re: StringJoin with ToString
  • Previous by thread: Re: Re: Help with ScriptSource in GUIKit
  • Next by thread: Re: Mathematica behavior using highlighting and keyboard arrows - BUG???