diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-10-22 20:08:37 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-10-22 20:08:37 +0000 |
| commit | 02b14d5fdd6fcccecd2e44b72e9dfe0d6eddaaa4 (patch) | |
| tree | 2fe7b5b1cc18fe58f8a7d89d135e26d7c1d34509 /documentation/editor.html | |
| parent | a79e377dc7689abc1ad3863eb691092a34e804b9 (diff) | |
Add section on the main() function to the editor example.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2685 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'documentation/editor.html')
| -rw-r--r-- | documentation/editor.html | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/documentation/editor.html b/documentation/editor.html index 6ea65ec2b..963b59229 100644 --- a/documentation/editor.html +++ b/documentation/editor.html @@ -570,6 +570,28 @@ void set_title(Fl_Window* w) { } </PRE></UL> +<H2>The main() Function</H2> + +<P>Once we've created all of the support functions, the only thing left +is to tie them all together with the <TT>main()</TT> function. +The <TT>main()</TT> function creates a new text buffer, creates a +new view (window) for the text, shows the window, loads the file on +the command-line (if any), and then enters the FLTK event loop: + +<UL><PRE> +int main(int argc, char **argv) { + textbuf = new Fl_Text_Buffer; + + Fl_Window* window = new_view(); + + window->show(1, argv); + + if (argc > 1) load_file(argv[1], -1); + + return Fl::run(); +} +</PRE></UL> + <H2>Compiling the Editor</H2> <P>The complete source for our text editor can be found in the <TT>test/editor.cxx</TT> source file. Both the Makefile and Visual C++ |
