Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Using MathLink to create a GUI

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61207] Re: Using MathLink to create a GUI
  • From: "Steven T. Hatton" <hattons at globalsymmetry.com>
  • Date: Wed, 12 Oct 2005 02:44:27 -0400 (EDT)
  • References: <dig3uc$lit$1@smc.vnet.net> <dii8gp$9at$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Jens-Peer Kuska wrote:

> | What's the best way to get a naked frontend
> widget? You know, the white
> | rectangle where you type in Mathematica code.
> 
> .. depend on the GUI libraries that you use.

Say Qt.  I really don't know how to get the X widget to live inside a Qt
widget.  They had some developmental code to support that kind of thing but
it was, shall we say, feature-fulL.

> |
> | Will this widget have some degree of Motif
> contamination?
> 
> .. depend on the GUI libraries that you use.
> But probably not.

Well, I won't be using Mitif, lestif, openMotif, etc.  GtK is a distant
second.  Mostly because I don't know it.
 
> |
> | Can I start a kernel from a program writting
> with MathLink?
> 
> Yes.

Unfortunately, I'm not sure that's what I want. If I can get a frontend
widget with the Motif ripped off, I can control the kernel through that(I
believe).  My intention is to use the FrontEndExecute[FrontEndToke["..."]]
construct, and override anything that calls Motif.

> |
> | Do I need a kernel to have a frontend widget.
> 
> It depend on your frontend. If you decide to
> do some computations that only the kernel can do
> before you frontend has finished its
> initialization
> you need a kernel, otherwise not.

I tried to figure out how to start a frontend using mathematica -mathlink,
but I didn't see any ports opened with netstat, and I don't see any
documentation on how to use the feature other than the one sentence telling
me it exists. All the attempts I made to specify a port failed.

> | If I run Mathematica from the
> | commandline, it typically launches a frontend
> instance with not kernel
> | running.  Is that an illusion?
> 
> No, the kernel is launched with the first Input
> that you try to evaluate.
> That's why it take longer to evaluate the first
> Input cell in a notebook.

Are you sure there isn't a kernel hiding in the frontend?  It sure does a
lot of Mathematica-type stuff that requires handling the same kinds of data
structures the kernel handles.
 
| If I want to do
> anything at all, I have to
> | have a kernel.  How do I then do things such as
> stop and start the kernel
> | from within the GUI?
 
> close the link to the kernel and reopen it.

That assumes the GUI isn't a child of the kernel.
 
> | If I can quit the kernel and keep a frontend
> widget
> | that it opened, then what do I do when I open a
> new notebook, start a
> | kernel?
> 
> *You* write the new frontend and you decide what
> your frontend will do
> in this case. You can also decide to reformat the
> root directory,

I would need root access to do that.

> or 
> delete all source code of the new frontend or
> start 10000 copy of xeyes.

Well, I plan on using the Mathematica Frontend X window. I just don't want
the Motif stuff.  Unfortunately, I don't see any way around having the
Motif hiding in the shadows.

I'm still working on learning the core Mathematica language, so I haven't
had a lot of opportunity to carefully study the available example code, and
documentation.  My expectation is that what I want to do is start a
nondisplaying frontend instance throughwhich I control all Notebook
instances using MathLink.  I'll maintain a C++ list mapping to opened
notebooks, and manipulate them through that handle.  It seems the thing to
do will be to create a QWidget wrapper object for a Mathematica notebook
widget, and pretend to talk to objects of that Qt class when controling the
Notebooks.  
-- 
"Philosophy is written in this grand book, The Universe. ... But the book
cannot be understood unless one first learns to comprehend the language...
in which it is written. It is written in the language of mathematics, ...;
without which wanders about in a dark labyrinth."   The Lion of Gaul


  • Prev by Date: Re: Re: Skipping Elements in Sum
  • Next by Date: RE: Change plot symbol in graphics 3D
  • Previous by thread: Re: Using MathLink to create a GUI
  • Next by thread: fourier transform