From 09daf20b81cdae78772f07c0af22a571d7cc73eb Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 29 Nov 2001 19:24:00 +0000 Subject: Documentation updates galore (up to chapter 7, still need to do chapter 8 and 9, tweek the appendices, and recapture the screenshots...) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1786 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/fluid.html | 598 +++++++++++++++++++++++------------------------ 1 file changed, 299 insertions(+), 299 deletions(-) (limited to 'documentation/fluid.html') diff --git a/documentation/fluid.html b/documentation/fluid.html index af360a96e..eade5232e 100644 --- a/documentation/fluid.html +++ b/documentation/fluid.html @@ -1,20 +1,20 @@

8 - Programming with FLUID

-This chapter shows how to use the Fast Light User-Interface Designer -("FLUID") to create your GUIs. +This chapter shows how to use the Fast Light User-Interface Designer +("FLUID") to create your GUIs.

What is FLUID?

-

The Fast Light User Interface Designer, or FLUID, is a graphical -editor that is used to produce FLTK source code. +

The Fast Light User Interface Designer, or FLUID, is a graphical +editor that is used to produce FLTK source code. -

FLUID edits and saves its state in .fl files. These files are -text, and you can (with care) edit them in a text editor, perhaps to +

FLUID edits and saves its state in .fl files. These files are +text, and you can (with care) edit them in a text editor, perhaps to get some special effects.

-

FLUID can "compile" the .fl file into a .cxx and a .h file. The -.cxx file defines all the objects from the .fl file and the .h file +

FLUID can "compile" the .fl file into a .cxx and a .h file. The +.cxx file defines all the objects from the .fl file and the .h file declares all the global ones.

FLUID also supports localization (Internationalization) @@ -22,41 +22,41 @@ of label strings using message files and the GNU gettext or POSIX catgets interfaces.

A simple program can be made by putting all your code (including a -main() function) into the .fl file and thus making the .cxx file a -single source file to compile. Most programs are more complex than -this, so you write other .cxx files that call the FLUID functions. +main() function) into the .fl file and thus making the .cxx file a +single source file to compile. Most programs are more complex than +this, so you write other .cxx files that call the FLUID functions. These .cxx files must #include the .h file or they can -#include the .cxx file so it still appears to be a single source +#include the .cxx file so it still appears to be a single source file.

FLUID organization.

Normally the FLUID file defines one or more functions or classes which -output C++ code. Each function defines a one or more FLTK +output C++ code. Each function defines a one or more FLTK windows, and all the widgets that go inside those windows.

-

Widgets created by FLUID are either "named", "complex named" or -"unnamed". A named widget has a legal C++ variable identifier as its -name (i.e. only alphanumeric and underscore). In this case FLUID -defines a global variable or class member that will point at the widget -after the function defining it is called. A complex named object has -punctuation such as '.' or '->' or any other symbols in its name. In -this case FLUID assigns a pointer to the widget to the name, but does -not attempt to declare it. This can be used to get the widgets into +

Widgets created by FLUID are either "named", "complex named" or +"unnamed". A named widget has a legal C++ variable identifier as its +name (i.e. only alphanumeric and underscore). In this case FLUID +defines a global variable or class member that will point at the widget +after the function defining it is called. A complex named object has +punctuation such as '.' or '->' or any other symbols in its name. In +this case FLUID assigns a pointer to the widget to the name, but does +not attempt to declare it. This can be used to get the widgets into structures. An unnamed widget has a blank name and no pointer is stored.

-

Widgets may either call a named callback function that you write in -another source file, or you can supply a small piece of C++ source and +

Widgets may either call a named callback function that you write in +another source file, or you can supply a small piece of C++ source and FLUID will write a private callback function into the .cxx file.

Running FLUID Under UNIX

- To run FLUID under UNIX, type: + To run FLUID under UNIX, type: -to edit the .fl file filename.fl. If the file does not exist -you will get an error pop-up, but if you dismiss it you will be editing -a blank file of that name. You can run FLUID without any name, in -which case you will be editing an unnamed blank setup (but you can use -save-as to write it to a file). +to edit the .fl file filename.fl. If the file does not exist +you will get an error pop-up, but if you dismiss it you will be editing +a blank file of that name. You can run FLUID without any name, in +which case you will be editing an unnamed blank setup (but you can use +save-as to write it to a file).

You can provide any of the standard FLTK switches before the filename:

- Changing the colors may be useful to see what your interface will look -at if the user calls it with the same switches. -

In the current version, if you don't go into the background (with -'&') then you will be able to abort FLUID by typing ^C on the terminal. It + Changing the colors may be useful to see what your interface will look +at if the user calls it with the same switches. +

In the current version, if you don't go into the background (with +'&') then you will be able to abort FLUID by typing ^C on the terminal. It will exit immediately, losing any changes.

Running FLUID Under Microsoft Windows

-To run FLUID under WIN32, double-click on the FLUID.exe file. -You can also run FLUID from the Command Prompt window (FLUID always -runs in the background under WIN32). +To run FLUID under WIN32, double-click on the FLUID.exe file. +You can also run FLUID from the Command Prompt window (FLUID always +runs in the background under WIN32).

Compiling .fl files

- FLUID can also be called as a command-line "compiler" to create the -.cxx and .h file from a .fl file. To do this type: + FLUID can also be called as a command-line "compiler" to create the +.cxx and .h file from a .fl file. To do this type: This will read the filename.fl file and write filename.cxx and -filename.h. The directory will be stripped, so they are written to -the current directory always. If there are any errors reading or -writing the files it will print the error and exit with a non-zero +filename.h. The directory will be stripped, so they are written to +the current directory always. If there are any errors reading or +writing the files it will print the error and exit with a non-zero code. In a makefile you can use a line like this: - Some versions of make will accept rules like this to allow all .fl -files found to be compiled: + Some versions of make will accept rules like this to allow all .fl +files found to be compiled: