MathGroup Archive 2005

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

Search the Archive

Re: MathLink and GUIKit


At 04:12 AM 5/24/2005, Goyan wrote:
>Hi all,
>
>I have a written C++ function called HSeg which I can call it after
>using "Install[]" using Mathlink, however, when I dont seem to be able
>to call the function within the GUIKit.  My code is as the following:
>
>HSegButton = GUIRun[
>      Widget["Panel", {Widget["
>         Button", {"text" -> "HSeg", BindEvent["mouseClicked",
>                 Script[HSeg[img]]]]}]}
>        ]
>      ]
>
>Can anyone help me with this?
>
>Thank you in advance.
>
>Goyan

Hello,

Each GUIKit definition by default runs within a protected $ContextPath
which does not include the Global` context.
When you call Install[] on your function outside the definition above
the symbol HSeg is most likely in the Global` context.

You can include the Global` context with the call to GUIRun above
using the option IncludedScriptContexts -> {"Global`"}

You can read more about how contexts are handled with GUIKit definitions
in the Help Browser documentation under
GUIKit -> Building GUIs -> Advanced Topics -> Scoping of Scripts

Jeff Adams
Wolfram Research


  • Prev by Date: Re: Applying a list of functions to a list of arguments
  • Next by Date: Re: FindFit with conditionals
  • Previous by thread: MathLink and GUIKit
  • Next by thread: Re: MathLink and GUIKit