[Insight-users] FLTK+ITK, Getting Started IV, how to generate/config myProjectGUI.fl?

Gavin Baker gavinb+xtk at cs.mu.OZ.AU
Thu Jun 16 21:49:54 EDT 2005


Hello Xuelin,

On Wed, Jun 15, 2005 at 09:44:18PM -1000, Xuelin Cui wrote:

> I am trying to test your example of "Getting Started IV", FLTK+ITK. But 
> how to generate the source code of myProjectGUI.cxx? Also, how to sue 
> fluid to generate the stuffs of myProjectGUI.fl?

Fluid is the FLTK interface builder, which is used to edit the .fl files
that describe the user interface.  As well as editing the GUI in its WYSIWYG
mode, Fluid can generate the C++ implementation code from the .fl interface
description.  This can be invoked from within Fluid using the File|Write
Code menu option, and also from the command line with the "-c" option.

However - if you use CMake and set up your project correctly, you don't have
to worry about that at all.  CMake can automatically invoke Fluid for you,
and generate the GUI implementation code whenever the .fl changes.  The
FLTK_WRAP_UI() command in CMake does this (provided you include the FLTK
package).  Many of the ITK demo programs use ITK, so you can browse the
source and see how they did it.

The short version is, all you need to do in your CMakeLists.txt file is
include the FLTK package:

  FIND_PACKAGE(FLTK)
  IF(FLTK_FOUND)
    INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
  ENDIF(FLTK_FOUND)

and then tell CMake to build the Fluid file for your application:

  FLTK_WRAP_UI(myProject myProjectGUI.fl)

And that's all!

You can read more about FLTK and using Fluid at:

    http://www.fltk.org
    http://www.fltk.org/doc-1.1/fluid.html#FLUID

Andy has written a great CMake tutorial, available here:

    http://www.linuxjournal.com/article/6700

  :: Gavin

-- 
Gavin Baker                                      Complex Systems Group
http://www.cs.mu.oz.au/~gavinb             The University of Melbourne


More information about the Insight-users mailing list