mirror of
https://github.com/fltk/fltk.git
synced 2026-06-07 00:55:23 +08:00
Typos reported by Alexander Mai
Fl_Browser_ docos finished. Added Fl_Group::init_sizes() description. Added links for common widgets in chapter 3 (?) Fixed formatting problems in subclassing and FLUID chapters. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1100 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+34
-22
@@ -1,24 +1,36 @@
|
||||
<HTML><BODY>
|
||||
<H1 ALIGN=RIGHT><A NAME=FLUID>8 - Programming with FLUID</A></H1>
|
||||
This chapter shows how to use the Fast Light User-Interface Designer
|
||||
|
||||
This chapter shows how to use the Fast Light User-Interface Designer
|
||||
("FLUID") to create your GUIs.
|
||||
|
||||
<H2>What is FLUID?</H2>
|
||||
The Fast Light User Interface Designer, or FLUID, is a graphical
|
||||
|
||||
<P>The Fast Light User Interface Designer, or FLUID, is a graphical
|
||||
editor that is used to produce FLTK source code.
|
||||
|
||||
<P>FLUID edits and saves its state in <TT>.fl</TT> files. These files are
|
||||
text, and you can (with care) edit them in a text editor, perhaps to
|
||||
get some special effects. </P>
|
||||
|
||||
<P>FLUID can "compile" the <TT>.fl</TT> file into a <TT>.cxx</TT> and a <TT>.h</TT> file. The
|
||||
<TT>.cxx</TT> file defines all the objects from the <TT>.fl</TT> file and the <TT>.h</TT> file
|
||||
declares all the global ones. </P>
|
||||
|
||||
<P>FLUID also supports localization (<A HREF="#I18N">Internationalization</A>)
|
||||
of label strings using message files and the GNU gettext or POSIX catgets
|
||||
interfaces.
|
||||
|
||||
<P>A simple program can be made by putting all your code (including a <TT>
|
||||
main()</TT> function) into the <TT>.fl</TT> file and thus making the <TT>.cxx</TT> file a
|
||||
single source file to compile. Most programs are more complex than
|
||||
this, so you write other <TT>.cxx</TT> files that call the FLUID functions.
|
||||
These <TT>.cxx</TT> files must <TT>#include</TT> the <TT>.h</TT> file or they can <TT>
|
||||
These <TT>.cxx</TT> files must <TT>#include</TT> the <TT>.h</TT> file or they can <TT>
|
||||
#include</TT> the <TT>.cxx</TT> file so it still appears to be a single source
|
||||
file.
|
||||
|
||||
<P ALIGN=CENTER><IMG src=fluid-org.gif>
|
||||
|
||||
<P>Normally the FLUID file defines one or more functions or classes which
|
||||
output C++ code. Each function defines a one or more FLTK
|
||||
windows, and all the widgets that go inside those windows. </P>
|
||||
@@ -61,7 +73,7 @@ save-as to write it to a file).
|
||||
Changing the colors may be useful to see what your interface will look
|
||||
at if the user calls it with the same switches.
|
||||
<P>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
|
||||
'&') then you will be able to abort FLUID by typing ^C on the terminal. It
|
||||
will exit immediately, losing any changes. </P>
|
||||
<H2>Running FLUID Under Microsoft Windows</H2>
|
||||
To run FLUID under WIN32, double-click on the <I>FLUID.exe</I> file.
|
||||
@@ -81,7 +93,7 @@ code. In a makefile you can use a line like this:
|
||||
<UL>
|
||||
<PRE>
|
||||
my_panels.h my_panels.cxx: my_panels.fl
|
||||
FLUID -c my_panels.fl
|
||||
fluid -c my_panels.fl
|
||||
</PRE>
|
||||
</UL>
|
||||
Some versions of make will accept rules like this to allow all <TT>.fl</TT>
|
||||
@@ -90,16 +102,16 @@ files found to be compiled:
|
||||
<PRE>
|
||||
.SUFFIXES: .fl .cxx .h
|
||||
.fl.h .fl.cxx:
|
||||
FLUID -c $<
|
||||
fluid -c $<
|
||||
</PRE>
|
||||
</UL>
|
||||
<H2>A Short Tutorial</H2>
|
||||
|
||||
FLUID is an amazingly powerful little program. However, this power
|
||||
comes at a price, as it is not always obvious how to accomplish seemingly
|
||||
comes at a price as it is not always obvious how to accomplish seemingly
|
||||
simple tasks with it. This tutorial will show you how to generate a
|
||||
complete user interface class with FLUID that is used for the CubeView
|
||||
program below.
|
||||
program provided with FLTK.
|
||||
|
||||
<P ALIGN=CENTER><IMG SRC="cubeview.gif"></P>
|
||||
|
||||
@@ -524,10 +536,6 @@ to reorder functions, classes, and windows within functions.
|
||||
<H4>Edit/Later (F3)</H4>
|
||||
Moves all of the selected widgets one later in order among the
|
||||
children of their parent (if possible).
|
||||
<P>
|
||||
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0>
|
||||
<TR>
|
||||
<TD VALIGN=TOP>
|
||||
<H4>Edit/Group (F7)</H4>
|
||||
Creates a new <tt>Fl_Group</tt> and make all the currently selected widgets
|
||||
children of it.
|
||||
@@ -539,14 +547,13 @@ selection. This makes it easier to see box borders and how the layout
|
||||
looks. The overlays will be forced back on if you change the
|
||||
selection.
|
||||
<H4>Edit/Preferences (Alt+p)</H4>
|
||||
|
||||
Displays the preferences panel. The alignment preferences control the
|
||||
grid that all widgets snap to when you move and resize them, and for the
|
||||
"snap" which is how far a widget has to be dragged from its original position
|
||||
to actually change.
|
||||
</TD>
|
||||
<TD VALIGN=TOP WIDTH=226><IMG SRC="fluid_prefs.gif"></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<P ALIGN="CENTER"><IMG SRC="fluid_prefs.gif"></P>
|
||||
|
||||
<P>The output filenames control the extensions or names of the files the are
|
||||
generated by FLUID. If you check the "Include .h from .cxx" button the code
|
||||
@@ -600,9 +607,7 @@ the widgets more accurately, especially when setting the box type.
|
||||
for the fields. In this case the value for <I>one</I> of the widgets
|
||||
is shown. But if you change this value, <I>all</I> of the selected
|
||||
widgets are changed to the new value.
|
||||
<TABLE cellpadding=0 cellspacing=0 width=100%>
|
||||
<TR>
|
||||
<TD VALIGN=TOP>Hitting "OK" makes the changes permanent. Selecting a different
|
||||
<P>Hitting "OK" makes the changes permanent. Selecting a different
|
||||
widget also makes the changes permanent. FLUID checks for simple
|
||||
syntax errors such as mismatched parenthesis in any code before
|
||||
saving any text.
|
||||
@@ -611,6 +616,10 @@ the panel or hit OK. However in the current version of FLUID, changes
|
||||
to "visible" attributes (such as the color, label, box) are not undone
|
||||
by revert or cancel. Changes to code like the callbacks are undone,
|
||||
however.
|
||||
<!-- NEW PAGE -->
|
||||
<TABLE cellpadding=0 cellspacing=0 width=100%>
|
||||
<TR>
|
||||
<TD VALIGN=TOP>
|
||||
<H3><A name=widget_attributes>Widget Attributes</A></H3>
|
||||
<H4>Name (text field)</H4>
|
||||
Name of a variable to declare, and to store a pointer to this
|
||||
@@ -620,13 +629,16 @@ blank then no variable is created.
|
||||
etc. This will cause FLUID to declare an array of pointers. The array
|
||||
is big enough that the highest number found can be stored. All widgets
|
||||
that in the array must be the same type. </P>
|
||||
</TD><TD VALIGN=TOP WIDTH=378><IMG src="fluid_widget.gif"></TD></TR>
|
||||
</TABLE>
|
||||
<H4>Type (upper-right pulldown menu)</H4>
|
||||
Some classes have subtypes that modify their appearance or behavior.
|
||||
You pick the subtype off of this menu.
|
||||
<H4>Box (pulldown menu)</H4>
|
||||
The boxtype to draw as a background for the widget.
|
||||
The boxtype to draw as a background for the widget.
|
||||
</TD>
|
||||
<TD> </TD>
|
||||
<TD VALIGN=TOP WIDTH=378><IMG src="fluid_widget.gif"></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<P>Many widgets will work, and draw faster, with a "frame" instead of a
|
||||
"box". A frame does not draw the colored interior, leaving whatever
|
||||
was already there visible. Be careful, as FLUID may draw this ok but
|
||||
|
||||
Reference in New Issue
Block a user