MathGroup Archive 2005

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

Search the Archive

Re: MathLink and GUIKit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57337] Re: [mg57293] MathLink and GUIKit
  • From: Jeff Adams <jeffa at wolfram.com>
  • Date: Wed, 25 May 2005 06:02:41 -0400 (EDT)
  • References: <200505240912.FAA19099@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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