fxruby 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Object Life Cycles and Garbage Collection</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="previous" href="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="next" href="apes03.html" title="Virtual Functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Object Life Cycles and Garbage Collection</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="implementation.html">Prev</a>&nbsp;</td><th width="60%" align="center">Appendix&nbsp;E.&nbsp;Implementation</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="apes03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4291"></a>Object Life Cycles and Garbage Collection</h2></div></div><div></div></div><p>One of the more difficult issues to deal with was understanding
3
+ <title>Object Life Cycles and Garbage Collection</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="previous" href="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="next" href="apes03.html" title="Virtual Functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Object Life Cycles and Garbage Collection</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="implementation.html">Prev</a>&nbsp;</td><th width="60%" align="center">Appendix&nbsp;E.&nbsp;Implementation</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="apes03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4333"></a>Object Life Cycles and Garbage Collection</h2></div></div><div></div></div><p>One of the more difficult issues to deal with was understanding
4
4
  the "life cycle" of FOX objects (that is, the actual C++ objects) and
5
5
  their relationship to the associated Ruby instances. Understanding this
6
6
  relationship is critical when dealing with Ruby's garbage collector,
@@ -18,4 +18,4 @@ myButton = FXButton.new(parentWin, "Hello, World!", myIcon)</pre></td></tr></tab
18
18
  returned from most class instance methods; they are references to already-
19
19
  existing objects. For example, <tt class="methodname">FXStatusBar#statusline
20
20
  </tt> returns a reference to the status bar's enclosed status line
21
- instance.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e4310"></a>GL Objects</h3></div></div><div></div></div><p>A C++ <tt class="classname">FXGLGroup</tt> object owns all of the <tt class="classname">FXGLObject</tt> objects it "contains". In other words, when that <tt class="classname">FXGLGroup</tt> object is destroyed, it will also destroy all of the <tt class="classname">FXGLObject</tt> objects for which it holds pointers.</p><p>In order to keep track of <span class="emphasis"><em>which</em></span> GL objects have been added to an <tt class="classname">FXGLGroup</tt>, all of the FXRuby C++ classes derived from <tt class="classname">FXGLObject</tt> have a boolean member variable <i class="structfield"><tt>owned</tt></i> that indicates whether this object is "owned" or not. Until an <tt class="classname">FXGLObject</tt> object is added to a group, this member variable should stay false.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="implementation.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="implementation.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="apes03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix&nbsp;E.&nbsp;Implementation&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Virtual Functions</td></tr></table></div></body></html>
21
+ instance.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e4352"></a>GL Objects</h3></div></div><div></div></div><p>A C++ <tt class="classname">FXGLGroup</tt> object owns all of the <tt class="classname">FXGLObject</tt> objects it "contains". In other words, when that <tt class="classname">FXGLGroup</tt> object is destroyed, it will also destroy all of the <tt class="classname">FXGLObject</tt> objects for which it holds pointers.</p><p>In order to keep track of <span class="emphasis"><em>which</em></span> GL objects have been added to an <tt class="classname">FXGLGroup</tt>, all of the FXRuby C++ classes derived from <tt class="classname">FXGLObject</tt> have a boolean member variable <i class="structfield"><tt>owned</tt></i> that indicates whether this object is "owned" or not. Until an <tt class="classname">FXGLObject</tt> object is added to a group, this member variable should stay false.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="implementation.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="implementation.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="apes03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix&nbsp;E.&nbsp;Implementation&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Virtual Functions</td></tr></table></div></body></html>
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Virtual Functions</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="previous" href="apes02.html" title="Object Life Cycles and Garbage Collection"><link rel="next" href="cvs.html" title="Appendix&nbsp;F.&nbsp;Getting the Sources from CVS"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Virtual Functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apes02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Appendix&nbsp;E.&nbsp;Implementation</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="cvs.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4344"></a>Virtual Functions</h2></div></div><div></div></div><p>
3
+ <title>Virtual Functions</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="implementation.html" title="Appendix&nbsp;E.&nbsp;Implementation"><link rel="previous" href="apes02.html" title="Object Life Cycles and Garbage Collection"><link rel="next" href="cvs.html" title="Appendix&nbsp;F.&nbsp;Getting the Sources from CVS"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Virtual Functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apes02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Appendix&nbsp;E.&nbsp;Implementation</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="cvs.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4386"></a>Virtual Functions</h2></div></div><div></div></div><p>
4
4
  One of the design requirements for FXRuby was to ensure that any
5
5
  virtual function call made on a FOX object (from the C++ library
6
6
  layer) is routed to the proper Ruby instance method, even if that
@@ -1,3 +1,3 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Developing Graphical User Interfaces with FXRuby</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="next" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Developing Graphical User Interfaces with FXRuby</th></tr><tr><td width="20%" align="left">&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="pt01.html">Next</a></td></tr></table><hr></div><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="book"></a>Developing Graphical User Interfaces with FXRuby</h1></div><div><h2 class="subtitle">Covers FXRuby Version 1.4</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Lyle</span> <span class="surname">Johnson</span></h3></div></div><div><p class="copyright">Copyright &copy; 2001-2005 J. Lyle Johnson</p></div></div><div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>I. <a href="pt01.html">The Basics</a></dt><dd><dl><dt><a href="goals.html">History and Goals</a></dt><dt>1. <a href="build.html">Building from Source Code</a></dt><dt>2. <a href="gems.html">Installing from Gems</a></dt><dt>3. <a href="tutorial1.html">Hello, World!</a></dt><dd><dl><dt><a href="tutorial1.html#d0e619">First Things First</a></dt><dt><a href="ch03s02.html">Better living through buttons</a></dt><dt><a href="ch03s03.html">Messages</a></dt><dt><a href="ch03s04.html">Adding a tool tip</a></dt><dt><a href="ch03s05.html">Adding an icon</a></dt></dl></dd><dt>4. <a href="clipboardtut.html">Working With the Clipboard</a></dt><dd><dl><dt><a href="clipboardtut.html#d0e1008">Basic Application</a></dt><dt><a href="ch04s02.html">Acquiring the Clipboard</a></dt><dt><a href="ch04s03.html">Sending Data to the Clipboard</a></dt><dt><a href="ch04s04.html">Pasting Data from the Clipboard</a></dt></dl></dd><dt>5. <a href="dragdroptut.html">Drag and Drop</a></dt><dd><dl><dt><a href="dragdroptut.html#d0e1223">Drop Sites</a></dt><dt><a href="ch05s02.html">Drag Sources</a></dt><dt><a href="ch05s03.html">Putting It All Together</a></dt></dl></dd><dt>6. <a href="examples.html">Examples</a></dt><dt>7. <a href="events.html">FXRuby's Message-Target System</a></dt><dt>8. <a href="todo.html">To-do list</a></dt><dt>9. <a href="infosources.html">Other Sources of Information</a></dt><dt>10. <a href="changes.html">Change History</a></dt></dl></dd><dt>II. <a href="pt02.html">Appendices</a></dt><dd><dl><dt>A. <a href="opengl.html">Using OpenGL with FXRuby</a></dt><dt>B. <a href="scintilla.html">Using Scintilla with FXRuby</a></dt><dt>C. <a href="differences.html">Differences between FOX and FXRuby</a></dt><dt>D. <a href="library.html">The FXRuby Standard Library</a></dt><dt>E. <a href="implementation.html">Implementation</a></dt><dd><dl><dt><a href="implementation.html#d0e4272">Code Generation</a></dt><dt><a href="apes02.html">Object Life Cycles and Garbage Collection</a></dt><dd><dl><dt><a href="apes02.html#d0e4310">GL Objects</a></dt></dl></dd><dt><a href="apes03.html">Virtual Functions</a></dt></dl></dd><dt>F. <a href="cvs.html">Getting the Sources from CVS</a></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="pt01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right" valign="top">&nbsp;Part&nbsp;I.&nbsp;The Basics</td></tr></table></div></body></html>
3
+ <title>Developing Graphical User Interfaces with FXRuby</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="next" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Developing Graphical User Interfaces with FXRuby</th></tr><tr><td width="20%" align="left">&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="pt01.html">Next</a></td></tr></table><hr></div><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="book"></a>Developing Graphical User Interfaces with FXRuby</h1></div><div><h2 class="subtitle">Covers FXRuby Version 1.4</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Lyle</span> <span class="surname">Johnson</span></h3></div></div><div><p class="copyright">Copyright &copy; 2001-2005 J. Lyle Johnson</p></div></div><div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt>I. <a href="pt01.html">The Basics</a></dt><dd><dl><dt><a href="goals.html">History and Goals</a></dt><dt>1. <a href="build.html">Building from Source Code</a></dt><dt>2. <a href="gems.html">Installing from Gems</a></dt><dt>3. <a href="tutorial1.html">Hello, World!</a></dt><dd><dl><dt><a href="tutorial1.html#d0e597">First Things First</a></dt><dt><a href="ch03s02.html">Better living through buttons</a></dt><dt><a href="ch03s03.html">Messages</a></dt><dt><a href="ch03s04.html">Adding a tool tip</a></dt><dt><a href="ch03s05.html">Adding an icon</a></dt></dl></dd><dt>4. <a href="clipboardtut.html">Working With the Clipboard</a></dt><dd><dl><dt><a href="clipboardtut.html#d0e986">Basic Application</a></dt><dt><a href="ch04s02.html">Acquiring the Clipboard</a></dt><dt><a href="ch04s03.html">Sending Data to the Clipboard</a></dt><dt><a href="ch04s04.html">Pasting Data from the Clipboard</a></dt></dl></dd><dt>5. <a href="dragdroptut.html">Drag and Drop</a></dt><dd><dl><dt><a href="dragdroptut.html#d0e1201">Drop Sites</a></dt><dt><a href="ch05s02.html">Drag Sources</a></dt><dt><a href="ch05s03.html">Putting It All Together</a></dt></dl></dd><dt>6. <a href="examples.html">Examples</a></dt><dt>7. <a href="events.html">FXRuby's Message-Target System</a></dt><dt>8. <a href="todo.html">To-do list</a></dt><dt>9. <a href="infosources.html">Other Sources of Information</a></dt><dt>10. <a href="changes.html">Change History</a></dt></dl></dd><dt>II. <a href="pt02.html">Appendices</a></dt><dd><dl><dt>A. <a href="opengl.html">Using OpenGL with FXRuby</a></dt><dt>B. <a href="scintilla.html">Using Scintilla with FXRuby</a></dt><dt>C. <a href="differences.html">Differences between FOX and FXRuby</a></dt><dt>D. <a href="library.html">The FXRuby Standard Library</a></dt><dt>E. <a href="implementation.html">Implementation</a></dt><dd><dl><dt><a href="implementation.html#d0e4314">Code Generation</a></dt><dt><a href="apes02.html">Object Life Cycles and Garbage Collection</a></dt><dd><dl><dt><a href="apes02.html#d0e4352">GL Objects</a></dt></dl></dd><dt><a href="apes03.html">Virtual Functions</a></dt></dl></dd><dt>F. <a href="cvs.html">Getting the Sources from CVS</a></dt></dl></dd></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="pt01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right" valign="top">&nbsp;Part&nbsp;I.&nbsp;The Basics</td></tr></table></div></body></html>
@@ -10,7 +10,7 @@
10
10
  Community Wiki</a>, in addition to the standard build instructions
11
11
  listed below.</p></li></ul></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e92"></a>Building From Source on Unix/Linux</h2></div></div><div></div></div><p>These instructions assume that you've already downloaded, compiled
12
12
  and installed FOX. Next, you'll need to download the FXRuby source code
13
- tarball and unpack it by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">tar xzf FXRuby-1.4.0.tar.gz</b></pre></td></tr></table><p>This will create a new directory called <tt class="filename">FXRuby-1.4.0</tt>. Change to the top-level
13
+ tarball and unpack it by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">tar xzf FXRuby-1.4.3.tar.gz</b></pre></td></tr></table><p>This will create a new directory called <tt class="filename">FXRuby-1.4.3</tt>. Change to the top-level
14
14
  directory and configure the build by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">ruby install.rb config</b></pre></td></tr></table><p>By default, the <tt class="filename">install.rb</tt> script will look for
15
15
  the FOX include files and library in the standard <tt class="filename">/usr/local/include/fox</tt> and <tt class="filename">/usr/local/lib</tt> directories, respectively. You
16
16
  can override these locations by passing a few additional arguments to
@@ -22,7 +22,7 @@
22
22
  problems during the compilation, please check the <a href="build.html#tragedies" title="Things That Can Go Wrong">list of things that can go wrong</a> for
23
23
  workarounds for those problems.</p><p>Once it's finished compiling, install FXRuby by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">ruby install.rb install</b></pre></td></tr></table><p>As a quick sanity check, to make sure that all is well, you should
24
24
  probably fire up <tt class="filename">irb</tt> and try to import FXRuby:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">irb</b>
25
- irb(main):001:0&gt; <b class="userinput"><tt>require 'fox'</tt></b>
25
+ irb(main):001:0&gt; <b class="userinput"><tt>require 'fox14'</tt></b>
26
26
  true
27
27
  irb(main):002:0&gt;</pre></td></tr></table><p>If the import failed (usually with a message along the lines of
28
28
  "Cannot load library"), check the <a href="build.html#tragedies" title="Things That Can Go Wrong">list of things
@@ -40,20 +40,11 @@ C:\ruby-1.8.2&gt;<b class="command">nmake</b></pre></td></tr></table><p>After th
40
40
  typing, e.g.,</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\ruby-1.8.2&gt;<b class="command">nmake DESTDIR=C:\ruby install</b></pre></td></tr></table><p>Similarly, I'm assuming that you built the FOX library using the
41
41
  Developer Studio project files distributed with the standard FOX source
42
42
  code distribution. Although it's possible to build FXRuby against either
43
- the static library build of FOX (<tt class="filename">fox.lib</tt>) or the DLL
44
- build (<tt class="filename">foxdll.dll</tt>), these instructions currently
45
- cover only the static library build. Before you get started building
46
- FXRuby itself, you'll need to rename the static FOX library from its
47
- default filename (<tt class="filename">fox.lib</tt>) to
48
- <tt class="filename">foxst.lib</tt>. The reason for this rename is a charming
49
- little quirk in Microsoft's LINK utility and the fact that the eventual
50
- output name for the FXRuby DLL is also <tt class="filename">fox.so</tt>; for
51
- now, just take my word for it. So if your FOX source code distribution and
52
- build are found in the <tt class="filename">C:\fox-1.4.17</tt> directory, you'd need to rename
53
- the file:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\fox-1.4.17\lib&gt;<b class="command">rename fox.lib foxst.lib</b></pre></td></tr></table><p>Now you can configure the FXRuby build by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.0&gt;<b class="command">ruby install.rb config --make-prog=nmake -- \
43
+ the static library build of FOX or the DLL build, these instructions
44
+ currently cover only the static library build.</p><p>Now you can configure the FXRuby build by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.3&gt;<b class="command">ruby install.rb config --make-prog=nmake -- \
54
45
  --with-fox-include=C:\fox-1.4.17\include \
55
46
  --with-fox-lib=C:\fox-1.4.17\lib</b></pre></td></tr></table><p>Once the build has been configured, you can start the build by
56
- typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.0&gt; <b class="command">ruby install.rb setup</b></pre></td></tr></table><p>It will take quite awhile to build FXRuby, even on a fast machine,
47
+ typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.3&gt;<b class="command">ruby install.rb setup</b></pre></td></tr></table><p>It will take quite awhile to build FXRuby, even on a fast machine,
57
48
  so this might be a good time to take a coffee break. Because Visual C++ is
58
49
  such a strict compiler (usually a good thing), you will probably run into
59
50
  a few problems with non-ANSI declarations in the Ruby header files. If you
@@ -61,8 +52,8 @@ C:\ruby-1.8.2&gt;<b class="command">nmake</b></pre></td></tr></table><p>After th
61
52
  for a list of things that could go wrong, and workarounds for those
62
53
  problems. None of them are showstoppers and none require you to restart
63
54
  the compile from scratch (just type <b class="command">ruby install.rb
64
- setup</b> to pick up where you left off).</p><p>Once it's finished compiling, install FXRuby by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.0&gt; <b class="command">ruby install.rb install</b></pre></td></tr></table><p>As a quick sanity check, to make sure that all is well, you should
65
- probably fire up <tt class="filename">irb</tt> and try to import FXRuby:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.0&gt; <b class="command">irb</b>
55
+ setup</b> to pick up where you left off).</p><p>Once it's finished compiling, install FXRuby by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.3&gt;<b class="command">ruby install.rb install</b></pre></td></tr></table><p>As a quick sanity check, to make sure that all is well, you should
56
+ probably fire up <tt class="filename">irb</tt> and try to import FXRuby:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">C:\FXRuby-1.4.0&gt;<b class="command">irb</b>
66
57
  irb(main):001:0&gt; <b class="userinput"><tt>require 'fox14'</tt></b>
67
58
  true
68
59
  irb(main):002:0&gt;</pre></td></tr></table><p>If the import failed (usually with a message along the lines of
@@ -119,7 +110,7 @@ core_wrap.cpp:108596: virtual memory exhausted</pre></td></tr></table><p>This fa
119
110
  locate the FOX shared library (<tt class="filename">libFOX-1.4.so</tt>) when it
120
111
  tries to dynamically load the FXRuby extension module; when this happens,
121
112
  the error message will look something like:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">irb</b>
122
- irb(main):001:0&gt; <b class="userinput"><tt>require 'fox'</tt></b>
113
+ irb(main):001:0&gt; <b class="userinput"><tt>require 'fox14'</tt></b>
123
114
  LoadError: libFOX-0.99.so.173: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/1.6/i586-linux/fox.so
124
115
  from (irb):1:in 'require'
125
116
  from (irb):1
@@ -128,7 +119,7 @@ LoadError: libFOX-0.99.so.173: cannot open shared object file: No such file or d
128
119
  directory where <tt class="filename">libFOX.so</tt> is installed. For example,
129
120
  if <tt class="filename">libFOX-1.4.so</tt> is installed in <tt class="filename">/usr/local/lib</tt>, try setting:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">$ <b class="command">export LD_LIBRARY_PATH=/usr/local/lib</b>
130
121
  $ <b class="command">irb</b>
131
- irb(main):001:0&gt; <b class="userinput"><tt>require 'fox'</tt></b>
122
+ irb(main):001:0&gt; <b class="userinput"><tt>require 'fox14'</tt></b>
132
123
  </pre></td></tr></table><p>If this works, you can of course permanently add the
133
124
  <tt class="constant">LD_LIBRARY_PATH</tt> setting to your login file(s) so that
134
125
  you don't have to remember to type it each time. Another approach that
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Better living through buttons</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="next" href="ch03s03.html" title="Messages"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Better living through buttons</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="tutorial1.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e746"></a>Better living through buttons</h2></div></div><div></div></div><p>Obviously, we need to add a few things to make it more interesting.
3
+ <title>Better living through buttons</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="next" href="ch03s03.html" title="Messages"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Better living through buttons</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="tutorial1.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e724"></a>Better living through buttons</h2></div></div><div></div></div><p>Obviously, we need to add a few things to make it more interesting.
4
4
  Let's start by putting a button inside the main window. The
5
5
  <tt class="classname">FXButton</tt> class provides a standard push-button
6
6
  widget:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'fox14'
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Messages</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="ch03s02.html" title="Better living through buttons"><link rel="next" href="ch03s04.html" title="Adding a tool tip"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Messages</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e777"></a>Messages</h2></div></div><div></div></div><p>Now we're cookin' with Crisco, but let's press on and see what other
3
+ <title>Messages</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="ch03s02.html" title="Better living through buttons"><link rel="next" href="ch03s04.html" title="Adding a tool tip"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Messages</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e755"></a>Messages</h2></div></div><div></div></div><p>Now we're cookin' with Crisco, but let's press on and see what other
4
4
  things we can do to improve this. You may have noticed by now that the
5
5
  only way to quit the program is to close the window using the window
6
6
  manager's "close window" option, or to just kill the program outright. We
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Adding a tool tip</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="ch03s03.html" title="Messages"><link rel="next" href="ch03s05.html" title="Adding an icon"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Adding a tool tip</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s05.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e868"></a>Adding a tool tip</h2></div></div><div></div></div><p>To wrap up this introduction, we'd like to add a few finishing
3
+ <title>Adding a tool tip</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="ch03s03.html" title="Messages"><link rel="next" href="ch03s05.html" title="Adding an icon"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Adding a tool tip</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch03s05.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e846"></a>Adding a tool tip</h2></div></div><div></div></div><p>To wrap up this introduction, we'd like to add a few finishing
4
4
  touches to the program. The first addition is to add a tool tip to the
5
5
  button, such that when the mouse cursor hovers over the button for a short
6
6
  while, it will pop up a little message describing what the button
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Adding an icon</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="ch03s04.html" title="Adding a tool tip"><link rel="next" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Adding an icon</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="clipboardtut.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e905"></a>Adding an icon</h2></div></div><div></div></div><p>The final change is to add an icon to the button to make things a
3
+ <title>Adding an icon</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="tutorial1.html" title="Chapter&nbsp;3.&nbsp;Hello, World!"><link rel="previous" href="ch03s04.html" title="Adding a tool tip"><link rel="next" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Adding an icon</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;3.&nbsp;Hello, World!</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="clipboardtut.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e883"></a>Adding an icon</h2></div></div><div></div></div><p>The final change is to add an icon to the button to make things a
4
4
  little more festive. FOX supports all of the popular image file formats
5
5
  (e.g. BMP, GIF, JPEG, PNG and TIFF) and you can use any of them as icons
6
6
  on buttons and labels. For this example, we'll use the one of the "Powered
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Acquiring the Clipboard</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="previous" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="next" href="ch04s03.html" title="Sending Data to the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Acquiring the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="clipboardtut.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1027"></a>Acquiring the Clipboard</h2></div></div><div></div></div><p>Let's begin by augmenting the GUI to include a row of buttons along
3
+ <title>Acquiring the Clipboard</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="previous" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="next" href="ch04s03.html" title="Sending Data to the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Acquiring the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="clipboardtut.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1005"></a>Acquiring the Clipboard</h2></div></div><div></div></div><p>Let's begin by augmenting the GUI to include a row of buttons along
4
4
  the bottom of the main window for copying and pasting:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
5
5
  require_gem 'fxruby'
6
6
  require 'customer'
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Sending Data to the Clipboard</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="previous" href="ch04s02.html" title="Acquiring the Clipboard"><link rel="next" href="ch04s04.html" title="Pasting Data from the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Sending Data to the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s04.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1076"></a>Sending Data to the Clipboard</h2></div></div><div></div></div><p>Whenever some other window requests the clipboard's contents (e.g.
3
+ <title>Sending Data to the Clipboard</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="previous" href="ch04s02.html" title="Acquiring the Clipboard"><link rel="next" href="ch04s04.html" title="Pasting Data from the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Sending Data to the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s04.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1054"></a>Sending Data to the Clipboard</h2></div></div><div></div></div><p>Whenever some other window requests the clipboard's contents (e.g.
4
4
  as a result of a "paste" operation) FOX will send a
5
5
  <tt class="constant">SEL_CLIPBOARD_REQUEST</tt> message to the current
6
6
  clipboard owner. Remember, the clipboard owner is the window that called
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Pasting Data from the Clipboard</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="previous" href="ch04s03.html" title="Sending Data to the Clipboard"><link rel="next" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Pasting Data from the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="dragdroptut.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1127"></a>Pasting Data from the Clipboard</h2></div></div><div></div></div><p>We've seen one side of the equation, copying string data to the
3
+ <title>Pasting Data from the Clipboard</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="clipboardtut.html" title="Chapter&nbsp;4.&nbsp;Working With the Clipboard"><link rel="previous" href="ch04s03.html" title="Sending Data to the Clipboard"><link rel="next" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Pasting Data from the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="dragdroptut.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1105"></a>Pasting Data from the Clipboard</h2></div></div><div></div></div><p>We've seen one side of the equation, copying string data to the
4
4
  clipboard. But before we can "round-trip" that customer data and paste it
5
5
  back into another copy of our customer list application, we're clearly
6
6
  going to need to transfer the data in some more useful format. That is to
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Drag Sources</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="previous" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="next" href="ch05s03.html" title="Putting It All Together"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Drag Sources</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dragdroptut.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch05s03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1375"></a>Drag Sources</h2></div></div><div></div></div><p>As before, we're going to start by presenting a skeleton application
3
+ <title>Drag Sources</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="previous" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="next" href="ch05s03.html" title="Putting It All Together"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Drag Sources</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dragdroptut.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch05s03.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1353"></a>Drag Sources</h2></div></div><div></div></div><p>As before, we're going to start by presenting a skeleton application
4
4
  consisting of a main window widget (a <tt class="classname">DragSource</tt>
5
5
  instance) that parents an <tt class="classname">FXCanvas</tt> widget:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
6
6
  require_gem 'fxruby'
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Putting It All Together</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="previous" href="ch05s02.html" title="Drag Sources"><link rel="next" href="examples.html" title="Chapter&nbsp;6.&nbsp;Examples"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Putting It All Together</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="examples.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1569"></a>Putting It All Together</h2></div></div><div></div></div><p>We've studied drag-and-drop enabled applications from two points of
3
+ <title>Putting It All Together</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="dragdroptut.html" title="Chapter&nbsp;5.&nbsp;Drag and Drop"><link rel="previous" href="ch05s02.html" title="Drag Sources"><link rel="next" href="examples.html" title="Chapter&nbsp;6.&nbsp;Examples"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Putting It All Together</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s02.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="examples.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1547"></a>Putting It All Together</h2></div></div><div></div></div><p>We've studied drag-and-drop enabled applications from two points of
4
4
  view, that of a drag source and that of a drop site. But for most
5
5
  applications, you'll want a window to act as both a drag source
6
6
  <span class="emphasis"><em>and</em></span> a drop site. As it turns out, this is just a
@@ -1,6 +1,29 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Chapter&nbsp;10.&nbsp;Change History</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="infosources.html" title="Chapter&nbsp;9.&nbsp;Other Sources of Information"><link rel="next" href="pt02.html" title="Part&nbsp;II.&nbsp;Appendices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;10.&nbsp;Change History</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="infosources.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="pt02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="changes"></a>Chapter&nbsp;10.&nbsp;Change History</h2></div></div><div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2403"></a>Changes For Version 1.4.3 (November 7, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>The <tt class="constant">TOGGLEBUTTON_KEEPSTATE</tt> option for the
3
+ <title>Chapter&nbsp;10.&nbsp;Change History</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="infosources.html" title="Chapter&nbsp;9.&nbsp;Other Sources of Information"><link rel="next" href="pt02.html" title="Part&nbsp;II.&nbsp;Appendices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;10.&nbsp;Change History</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="infosources.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="pt02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="changes"></a>Chapter&nbsp;10.&nbsp;Change History</h2></div></div><div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2381"></a>Changes For Version 1.4.4 (January 21, 2006)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>The build instructions for Unix platforms had not been updated
4
+ recently and as such contained some errors (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=3014&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
5
+ Bug #3014</a>). These errors have been corrected. Thanks to Dave
6
+ Burns for reporting this problem.</p></li><li style="list-style-type: disc"><p>The <tt class="methodname">extendSelection</tt> method for the
7
+ <tt class="classname">FXTable</tt> class was raising an exception if an
8
+ out of bounds row or column index was passed in (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=3050&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
9
+ Bug #3050</a>). This has been changed so that
10
+ <tt class="methodname">extendSelection</tt> instead returns false for out
11
+ of bounds arguments. Thanks to Leonid Moiseichuk for reporting this
12
+ problem.</p></li><li style="list-style-type: disc"><p>The <tt class="methodname">each_child</tt> iterator method for the
13
+ <tt class="classname">FXWindow</tt> class would fail if the child window
14
+ was destroyed in the block (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=3134&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
15
+ Bug #3134</a>). Thanks to Liam Irish for reporting this problem
16
+ and providing a patch.</p></li><li style="list-style-type: disc"><p>The message data for the <tt class="constant">SEL_REPLACED</tt>
17
+ message sent by the <tt class="classname">FXTable</tt> class to its target
18
+ was not being handled properly (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=3244&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
19
+ Bug #3244</a>). There were also problems with the message data for
20
+ the <tt class="constant">SEL_SELECTED</tt> and
21
+ <tt class="constant">SEL_DESELECTED</tt> messages. Furthermore, the
22
+ <tt class="constant">SEL_REPLACED</tt> message was not documented in the
23
+ RDoc documentation for the <tt class="classname">FXTable</tt> class. All
24
+ of these problems have been corrected. Thanks to _blackdog for
25
+ reporting this problem.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.4.29 and
26
+ FXScintilla version 1.63.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2445"></a>Changes For Version 1.4.3 (November 7, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>The <tt class="constant">TOGGLEBUTTON_KEEPSTATE</tt> option for the
4
27
  <tt class="classname">FXToggleButton</tt> class was not documented (see
5
28
  <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=2286&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
6
29
  Bug #2286</a>). This oversight has been corrected. Thanks to Tim
@@ -35,7 +58,7 @@
35
58
  been fixed, and the documentation for
36
59
  <tt class="methodname">makePositionVisible</tt> has been updated
37
60
  accordingly. Thanks to Ralf Jonas for reporting this problem.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.4.21 and
38
- FXScintilla version 1.63.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2488"></a>Changes For Version 1.4.2 (August 22, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>Due to a bug in the implementation, the
61
+ FXScintilla version 1.63.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2530"></a>Changes For Version 1.4.2 (August 22, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>Due to a bug in the implementation, the
39
62
  <tt class="methodname">checked?</tt> method for the
40
63
  <tt class="classname">FXCheckButton</tt> class always returned
41
64
  <tt class="constant">false</tt> (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=1852&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
@@ -62,7 +85,7 @@
62
85
  <tt class="classname">FXFileStream</tt> class were broken (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=2275&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
63
86
  Bug #2275</a>). This problem has been corrected. Thanks to Gonzalo
64
87
  Garramuno for reporting this problem.</p></li><li style="list-style-type: disc"><p>Merged in all of the fixes for FXRuby 1.2.6.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.4.17 and
65
- FXScintilla version 1.63.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2579"></a>Changes For Version 1.4.1 (August 20, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>This is the second release of FXRuby which is compatible with
88
+ FXScintilla version 1.63.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2621"></a>Changes For Version 1.4.1 (August 20, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>This is the second release of FXRuby which is compatible with
66
89
  FOX 1.4, and as such should be considered an "unstable" release. For a
67
90
  history of the changes made during the FOX 1.3 and 1.4 development,
68
91
  see the <a href="http://www.fox-toolkit.com/news.html" target="_top">News</a>
@@ -71,11 +94,11 @@
71
94
  feature, and were still looking at <tt class="constant">fox12</tt>. This
72
95
  has been corrected.</p></li><li style="list-style-type: disc"><p>A number of minor problems were corrected for the Windows build
73
96
  of FXRuby.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.4.17 and
74
- FXScintilla version 1.63.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2607"></a>Changes For Version 1.4.0 (August 19, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>This is the first release of FXRuby which is compatible with FOX
97
+ FXScintilla version 1.63.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2649"></a>Changes For Version 1.4.0 (August 19, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>This is the first release of FXRuby which is compatible with FOX
75
98
  1.4, and as such should be considered an "unstable" release. For a
76
99
  history of the changes made during the FOX 1.3 and 1.4 development,
77
100
  see the <a href="http://www.fox-toolkit.com/news.html" target="_top">News</a>
78
- page at the FOX Web site.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2617"></a>Changes For Version 1.2.6 (April 15, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>Some additional problems related to calling the
101
+ page at the FOX Web site.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2659"></a>Changes For Version 1.2.6 (April 15, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>Some additional problems related to calling the
79
102
  <tt class="methodname">setTableSize</tt> method for an
80
103
  <tt class="classname">FXTable</tt> were discovered (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=1597&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
81
104
  Bug #1597</a>). This problem has been corrected. Thanks to Joel
@@ -123,7 +146,7 @@
123
146
  to be unavailable as well (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=1771&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
124
147
  Bug #1771</a>). This error has been corrected. Thanks to Jannis
125
148
  Pohlmann for reporting this problem.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.2.16 and
126
- FXScintilla version 1.62.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2753"></a>Changes For Version 1.2.5 (March 1, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>The change made for FXRuby version 1.2.4 regarding garbage
149
+ FXScintilla version 1.62.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2795"></a>Changes For Version 1.2.5 (March 1, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>The change made for FXRuby version 1.2.4 regarding garbage
127
150
  collection for table items corrected only one of the problems
128
151
  described in <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=1445&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
129
152
  Bug #1445</a>; There was still a problem related to the
@@ -153,7 +176,7 @@
153
176
  <tt class="methodname">selectRange</tt> method under the hood (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=1562&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
154
177
  Bug #1562</a>). Thanks to Joel VanderWerf for this
155
178
  suggestion.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.2.13 and
156
- FXScintilla version 1.62.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2838"></a>Changes For Version 1.2.4 (February 23, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>Due to a change in some of the internal Ruby C APIs, a
179
+ FXScintilla version 1.62.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2880"></a>Changes For Version 1.2.4 (February 23, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>Due to a change in some of the internal Ruby C APIs, a
157
180
  compile-time error for FXRuby was introduced in some of the Ruby 1.8.2
158
181
  preview releases (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=1039&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
159
182
  Bug #1039</a>). One should not see any compile-time errors when
@@ -203,7 +226,7 @@
203
226
  <tt class="classname">FXTable</tt> class (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=1426&amp;group_id=300&amp;atid=1226" target="_top">RubyForge
204
227
  Feature Request #1295</a>). Thanks to Brett Hallett for this
205
228
  suggestion.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.2.13 and
206
- FXScintilla version 1.62.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2941"></a>Changes For Version 1.2.3 (January 22, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>Since group boxes containing radio buttons no longer enforce the
229
+ FXScintilla version 1.62.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2983"></a>Changes For Version 1.2.3 (January 22, 2005)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>Since group boxes containing radio buttons no longer enforce the
207
230
  radio behavior of radio buttons (i.e. keeping only one radio button
208
231
  selected at a time), some of the example programs were no longer
209
232
  working as desired (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=751&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
@@ -266,7 +289,7 @@
266
289
  documented incorrectly (see <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=1325&amp;group_id=300&amp;atid=1223" target="_top">RubyForge
267
290
  Bug #1325</a>). These have been corrected. Thanks to Karl El-Koura
268
291
  for reporting this problem.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.2.13 and
269
- FXScintilla version 1.62.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3113"></a>Changes For Version 1.2.2 (October 1, 2004)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>In order to avoid versioning problems when dealing with a mix of
292
+ FXScintilla version 1.62.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3155"></a>Changes For Version 1.2.2 (October 1, 2004)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>In order to avoid versioning problems when dealing with a mix of
270
293
  applications based on either FXRuby 1.0 or 1.2, the feature name for
271
294
  FXRuby has been changed from "fox" to "fox12". For most application
272
295
  developers, this means that you will need to modify the source code
@@ -274,7 +297,7 @@
274
297
  changes should be required for legacy applications targeted at FXRuby
275
298
  1.0.</p></li><li style="list-style-type: disc"><p>Made a number of updates to the documentation, to reflect API
276
299
  changes for FXRuby 1.2.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.2.9 and
277
- FXScintilla version 1.61.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3130"></a>Changes For Version 1.2a2 (July 10, 2004)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>This is the second "alpha" release of FXRuby 1.2. This release
300
+ FXScintilla version 1.61.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3172"></a>Changes For Version 1.2a2 (July 10, 2004)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>This is the second "alpha" release of FXRuby 1.2. This release
278
301
  should be compatible with any FOX library version 1.2; it is not
279
302
  compatible with any previous FOX library versions. As this is an alpha
280
303
  release, users should expect a certain amount of instability, bugs,
@@ -316,7 +339,7 @@
316
339
  or JPEG image support built-in (see <a href="http://sourceforge.net/tracker/index.php?func=detail&amp;aid=986180&amp;group_id=20243&amp;atid=120243" target="_top">SourceForge
317
340
  Bug #986180</a>). This has been fixed. Thanks to Bil Bas for
318
341
  reporting this problem.</p></li><li style="list-style-type: disc"><p>The binary gem for Windows was built with FOX version 1.2.7 and
319
- FXScintilla version 1.61.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3239"></a>Changes For Version 1.2a1 (June 28, 2004)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>This is the first "alpha" release of FXRuby 1.2. This release
342
+ FXScintilla version 1.61.</p></li></ul></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3281"></a>Changes For Version 1.2a1 (June 28, 2004)</h2></div></div><div></div></div><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc"><p>This is the first "alpha" release of FXRuby 1.2. This release
320
343
  should be compatible with any FOX library version 1.2; it is not
321
344
  compatible with any previous FOX library versions. As this is an alpha
322
345
  release, users should expect a certain amount of instability, bugs,
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Chapter&nbsp;4.&nbsp;Working With the Clipboard</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="ch03s05.html" title="Adding an icon"><link rel="next" href="ch04s02.html" title="Acquiring the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="clipboardtut"></a>Chapter&nbsp;4.&nbsp;Working With the Clipboard</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="clipboardtut.html#d0e1008">Basic Application</a></dt><dt><a href="ch04s02.html">Acquiring the Clipboard</a></dt><dt><a href="ch04s03.html">Sending Data to the Clipboard</a></dt><dt><a href="ch04s04.html">Pasting Data from the Clipboard</a></dt></dl></div><p>Two of the standard FOX widgets, <tt class="classname">FXText</tt> and
3
+ <title>Chapter&nbsp;4.&nbsp;Working With the Clipboard</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="ch03s05.html" title="Adding an icon"><link rel="next" href="ch04s02.html" title="Acquiring the Clipboard"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;4.&nbsp;Working With the Clipboard</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="clipboardtut"></a>Chapter&nbsp;4.&nbsp;Working With the Clipboard</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="clipboardtut.html#d0e986">Basic Application</a></dt><dt><a href="ch04s02.html">Acquiring the Clipboard</a></dt><dt><a href="ch04s03.html">Sending Data to the Clipboard</a></dt><dt><a href="ch04s04.html">Pasting Data from the Clipboard</a></dt></dl></div><p>Two of the standard FOX widgets, <tt class="classname">FXText</tt> and
4
4
  <tt class="classname">FXTextField</tt>, provide clipboard support out of the
5
5
  box. For example, you can select some text in an
6
6
  <tt class="classname">FXTextField</tt> and then press Ctrl+C to copy that text
@@ -9,7 +9,7 @@
9
9
  <tt class="classname">FXText</tt> or <tt class="classname">FXTextField</tt> widget.
10
10
  The purpose of this tutorial is to demonstrate how to interact with the
11
11
  clipboard programmatically, so that you can integrate additional clipboard
12
- support into your FXRuby applications.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1008"></a>Basic Application</h2></div></div><div></div></div><p>In order to illustrate how to integrate cut and paste operations
12
+ support into your FXRuby applications.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e986"></a>Basic Application</h2></div></div><div></div></div><p>In order to illustrate how to integrate cut and paste operations
13
13
  into your application, we'll start from a simple FXRuby application that
14
14
  doesn't yet provide any clipboard support. This application simply
15
15
  presents a list of customers (from some external source).</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
@@ -19,13 +19,13 @@
19
19
  modified SWIG interface files. I always use the latest development version
20
20
  of <a href="http://www.swig.org" target="_top">SWIG</a>, but any release after,
21
21
  say, SWIG 1.3.15 should work fine. The older SWIG 1.1 releases will
22
- definitely <span class="emphasis"><em>not</em></span> work.</p><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4453"></a>Checking out the stable version</h2></div></div><div></div></div><p>The stable version of FXRuby is the 1.0.x branch and is compatible
22
+ definitely <span class="emphasis"><em>not</em></span> work.</p><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4495"></a>Checking out the stable version</h2></div></div><div></div></div><p>The stable version of FXRuby is the 1.0.x branch and is compatible
23
23
  with any of the FOX 1.0.x releases. It is <span class="emphasis"><em>not</em></span>
24
24
  compatible with any other release branches of FOX (e.g. the FOX 1.2.x or
25
25
  1.3.x series of releases).</p><p>To check out the stable version of FXRuby, do the following:</p><div class="orderedlist"><ol type="1"><li><p>Log in to the CVS server by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">cvs -d:pserver:anonymous@rubyforge.org:/var/cvs/fxruby login</pre></td></tr></table><p>When prompted for a password for <span class="emphasis"><em>anonymous</em></span>,
26
26
  simply press the <b class="keycap">Enter</b> key.</p></li><li><p>Check out the stable branch of FXRuby by typing:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="screen">cvs -z3 -d:pserver:anonymous@rubyforge.org:/var/cvs/fxruby co -rrelease10 FXRuby</pre></td></tr></table></li></ol></div><p>At this point, you should be ready to change to the top-level
27
27
  directory and go through the normal build and installation process, as
28
- described in an earlier chapter.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4486"></a>Regenerating wrapper code with SWIG</h2></div></div><div></div></div><p>If you make changes to any of the SWIG interface files (the files
28
+ described in an earlier chapter.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4528"></a>Regenerating wrapper code with SWIG</h2></div></div><div></div></div><p>If you make changes to any of the SWIG interface files (the files
29
29
  ending with a <tt class="filename">.i</tt> extension, in the <tt class="filename">swig-interfaces</tt> subdirectory) you will need
30
30
  to re-run SWIG to regenerate parts of the FXRuby source code:</p><div class="orderedlist"><ol type="1"><li><p>Change directories to the <tt class="filename">swig-interfaces</tt> subdirectory of the
31
31
  FXRuby source tree.</p></li><li><p>Type the following command to create a "bootstrap"
@@ -1,11 +1,11 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt02.html" title="Part&nbsp;II.&nbsp;Appendices"><link rel="previous" href="scintilla.html" title="Appendix&nbsp;B.&nbsp;Using Scintilla with FXRuby"><link rel="next" href="library.html" title="Appendix&nbsp;D.&nbsp;The FXRuby Standard Library"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="scintilla.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;II.&nbsp;Appendices</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="library.html">Next</a></td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="differences"></a>Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</h2></div></div><div></div></div><p>The FXRuby API follows the FOX API very closely and for the most part, you should be able to use the standard FOX class documentation as a reference. In some cases, however, fundamental differences between Ruby and C++ necessitated slight changes in the API. For some other cases, FOX classes were enhanced to take advantage of Ruby language features (such as iterators). The purpose of this chapter is to identify some of the differences between the C++ and Ruby interfaces to FOX.</p><p>One difference that should be easy to cope with is the substitution of Ruby Strings for FXStrings. Any function that would normally expect an <span class="type">FXString</span> input argument insteads takes a Ruby String. Similarly, functions that would return an <span class="type">FXString</span> will instead return a Ruby string. For functions that would normally accept a <tt class="constant">NULL</tt> or empty string argument, just pass <tt class="constant">nil</tt> or an empty string ("").</p><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3534"></a>Functions that expect arrays of objects</h2></div></div><div></div></div><p>One common pattern in FOX member function argument lists is to expect a pointer to an array of values, followed by an integer indicating the number of values in the array. This of course isn't necessary in Ruby, where <tt class="classname">Array</tt> objects "know" their lengths. As a result, functions such as <tt class="methodname">FXWindow::acquireClipboard()</tt>, whose C++ declaration looks like this:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXbool acquireClipboard(const FXDragType *types, FXuint numTypes);</pre></td></tr></table><p>are called from Ruby code by passing in a single <tt class="classname">Array</tt> argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">myWindow.acquireClipboard(typesArray)</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3554"></a>Functions that return values by reference</h2></div></div><div></div></div><p>Many FOX methods take advantage of the C++ language feature of returning values by reference. For example, the <tt class="methodname">getCursorPos()</tt> member function for class <tt class="classname">FXWindow</tt> has the declaration:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXint getCursorPos(FXint&amp; x, FXint&amp; y, FXint&amp; buttons) const;</pre></td></tr></table><p>which indicates that the function takes references to three integers (x, y and buttons). To call this function from a C++ program, you'd write code like this:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXint x, y;
3
+ <title>Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt02.html" title="Part&nbsp;II.&nbsp;Appendices"><link rel="previous" href="scintilla.html" title="Appendix&nbsp;B.&nbsp;Using Scintilla with FXRuby"><link rel="next" href="library.html" title="Appendix&nbsp;D.&nbsp;The FXRuby Standard Library"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="scintilla.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;II.&nbsp;Appendices</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="library.html">Next</a></td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="differences"></a>Appendix&nbsp;C.&nbsp;Differences between FOX and FXRuby</h2></div></div><div></div></div><p>The FXRuby API follows the FOX API very closely and for the most part, you should be able to use the standard FOX class documentation as a reference. In some cases, however, fundamental differences between Ruby and C++ necessitated slight changes in the API. For some other cases, FOX classes were enhanced to take advantage of Ruby language features (such as iterators). The purpose of this chapter is to identify some of the differences between the C++ and Ruby interfaces to FOX.</p><p>One difference that should be easy to cope with is the substitution of Ruby Strings for FXStrings. Any function that would normally expect an <span class="type">FXString</span> input argument insteads takes a Ruby String. Similarly, functions that would return an <span class="type">FXString</span> will instead return a Ruby string. For functions that would normally accept a <tt class="constant">NULL</tt> or empty string argument, just pass <tt class="constant">nil</tt> or an empty string ("").</p><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3576"></a>Functions that expect arrays of objects</h2></div></div><div></div></div><p>One common pattern in FOX member function argument lists is to expect a pointer to an array of values, followed by an integer indicating the number of values in the array. This of course isn't necessary in Ruby, where <tt class="classname">Array</tt> objects "know" their lengths. As a result, functions such as <tt class="methodname">FXWindow::acquireClipboard()</tt>, whose C++ declaration looks like this:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXbool acquireClipboard(const FXDragType *types, FXuint numTypes);</pre></td></tr></table><p>are called from Ruby code by passing in a single <tt class="classname">Array</tt> argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">myWindow.acquireClipboard(typesArray)</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3596"></a>Functions that return values by reference</h2></div></div><div></div></div><p>Many FOX methods take advantage of the C++ language feature of returning values by reference. For example, the <tt class="methodname">getCursorPos()</tt> member function for class <tt class="classname">FXWindow</tt> has the declaration:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXint getCursorPos(FXint&amp; x, FXint&amp; y, FXint&amp; buttons) const;</pre></td></tr></table><p>which indicates that the function takes references to three integers (x, y and buttons). To call this function from a C++ program, you'd write code like this:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXint x, y;
4
4
  FXuint buttons;
5
5
 
6
6
  if (window-&gt;getCursorPosition(x, y, buttons))
7
- fprintf(stderr, "Current position is (%d, %d)\n", x, y);</pre></td></tr></table><p>Since this idiom doesn't translate well to Ruby, some functions' interfaces have been slightly modified. For example, the FXRuby implementation of <tt class="methodname">getCursorPos()</tt> returns the three values as an <tt class="classname">Array</tt>, e.g.:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">x, y, buttons = aWindow.getCursorPos()</pre></td></tr></table><p>The following table shows how these kinds of functions are implemented in FXRuby:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Instance Method</th><th align="center">Return Value</th></tr></thead><tbody><tr><td><tt class="methodname">FXDial#range</tt></td><td>Returns a <tt class="classname">Range</tt> instance.</td></tr><tr><td><tt class="methodname">FXDial#range=(aRange)</tt></td><td>Accepts a <tt class="classname">Range</tt> instance as its input.</td></tr><tr><td><tt class="methodname">FXFontDialog#fontSelection</tt></td><td>Returns the <tt class="classname">FXFontDesc</tt> instance</td></tr><tr><td><tt class="methodname">FXFontSelector#fontSelection</tt></td><td>Returns the <tt class="classname">FXFontDesc</tt> instance</td></tr><tr><td><tt class="methodname">FXGLObject#bounds(range)</tt></td><td>Takes an <tt class="classname">FXRange</tt> instance as its input and returns a (possibly modified) <tt class="classname">FXRange</tt> instance.</td></tr><tr><td><tt class="methodname">FXGLViewer#eyeToScreen(eye)</tt></td><td>Takes an array of eye coordinates (floats) as its input and returns the screen point coordinate as an array of integers [sx, sy]</td></tr><tr><td><tt class="methodname">FXGLViewer#getBoreVector(sx, sy)</tt></td><td>Returns the endpoint and direction vector as an array of arrays [point, dir]</td></tr><tr><td><tt class="methodname">FXGLViewer#light</tt></td><td>Returns a <tt class="classname">FXLight</tt> instance</td></tr><tr><td><tt class="methodname">FXGLViewer#viewport</tt></td><td>Returns an <tt class="classname">FXViewport</tt> instance.</td></tr><tr><td><tt class="methodname">FXPrinterDialog#printer</tt></td><td>Returns the <tt class="classname">FXPrinter</tt> instance</td></tr><tr><td><tt class="methodname">FXScrollArea#position</tt></td><td>Returns the position as an array of integers [x, y]</td></tr><tr><td><tt class="methodname">FXSlider#range</tt></td><td>Returns a <tt class="classname">Range</tt> instance.</td></tr><tr><td><tt class="methodname">FXSlider#range=(aRange)</tt></td><td>Accepts a <tt class="classname">Range</tt> instance as its input.</td></tr><tr><td><tt class="methodname">FXSpinner#range</tt></td><td>Returns a <tt class="classname">Range</tt> instance.</td></tr><tr><td><tt class="methodname">FXSpinner#range=(aRange)</tt></td><td>Accepts a <tt class="classname">Range</tt> instance as its input.</td></tr><tr><td><tt class="methodname">FXText#appendText(text, notify=false)</tt></td><td>Append text to the end of the buffer.</td></tr><tr><td><tt class="methodname">FXText#appendStyledText(text, style=0, notify=false)</tt></td><td>Append styled text to the end of the buffer.</td></tr><tr><td><tt class="methodname">FXText#extractText(pos, n)</tt></td><td>Extracts <span class="emphasis"><em>n</em></span> characters from the buffer beginning at position <span class="emphasis"><em>pos</em></span> and returns the result as a String.</td></tr><tr><td><tt class="methodname">FXText#extractStyle(pos, n)</tt></td><td>Extracts <span class="emphasis"><em>n</em></span> style characters from the buffer beginning at position <span class="emphasis"><em>pos</em></span> and returns the result as a String.</td></tr><tr><td><tt class="methodname">FXText#insertText(pos, text, notify=false)</tt></td><td>Insert <span class="emphasis"><em>text</em></span> at position <span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><tt class="methodname">FXText#insertStyledText(pos, text, style=0, notify=false)</tt></td><td>Insert <span class="emphasis"><em>text</em></span> at position <span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><tt class="methodname">FXText#replaceText(pos, m, text, notify=false)</tt></td><td>Replace <span class="emphasis"><em>m</em></span> characters at <span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><tt class="methodname">FXText#replaceStyledText(pos, m, text, style=0, notify=false)</tt></td><td>Replace <span class="emphasis"><em>m</em></span> characters at <span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><tt class="methodname">FXText#setDelimiters(delimiters)</tt></td><td>Change delimiters of words (<span class="emphasis"><em>delimiters</em></span> is a string).</td></tr><tr><td><tt class="methodname">FXText#getDelimiters()</tt></td><td>Return word delimiters as a string.</td></tr><tr><td><tt class="methodname">FXWindow#cursorPosition</tt></td><td>Returns an array of integers [x, y, buttons]</td></tr><tr><td><tt class="methodname">FXWindow#translateCoordinatesFrom(window, x, y)</tt></td><td>Returns the translated coordinates as an array [x, y]</td></tr><tr><td><tt class="methodname">FXWindow#translateCoordinatesTo(window, x, y)</tt></td><td>Returns the translated coordinates as an array [x, y]</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3844"></a>Iterators</h2></div></div><div></div></div><p>Several classes have been extended with an <tt class="methodname">each</tt> method to provide Ruby-style iterators. These classes include <tt class="classname">FXComboBox</tt>, <tt class="classname">FXGLGroup</tt>, <tt class="classname">FXHeader</tt>, <tt class="classname">FXIconList</tt>, <tt class="classname">FXList</tt>, <tt class="classname">FXListBox</tt>, <tt class="classname">FXTreeItem</tt>, <tt class="classname">FXTreeList</tt> and <tt class="classname">FXTreeListBox</tt>. These classes also mix-in Ruby's <tt class="classname">Enumerable</tt> module so that you can take full advantage of the iterators.</p><p>The block parameters passed to your code block vary depending on the class. For example, iterating over an <tt class="classname">FXList</tt> instance yields <tt class="classname">FXListItem</tt> parameters:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aList.each { |aListItem|
7
+ fprintf(stderr, "Current position is (%d, %d)\n", x, y);</pre></td></tr></table><p>Since this idiom doesn't translate well to Ruby, some functions' interfaces have been slightly modified. For example, the FXRuby implementation of <tt class="methodname">getCursorPos()</tt> returns the three values as an <tt class="classname">Array</tt>, e.g.:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">x, y, buttons = aWindow.getCursorPos()</pre></td></tr></table><p>The following table shows how these kinds of functions are implemented in FXRuby:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Instance Method</th><th align="center">Return Value</th></tr></thead><tbody><tr><td><tt class="methodname">FXDial#range</tt></td><td>Returns a <tt class="classname">Range</tt> instance.</td></tr><tr><td><tt class="methodname">FXDial#range=(aRange)</tt></td><td>Accepts a <tt class="classname">Range</tt> instance as its input.</td></tr><tr><td><tt class="methodname">FXFontDialog#fontSelection</tt></td><td>Returns the <tt class="classname">FXFontDesc</tt> instance</td></tr><tr><td><tt class="methodname">FXFontSelector#fontSelection</tt></td><td>Returns the <tt class="classname">FXFontDesc</tt> instance</td></tr><tr><td><tt class="methodname">FXGLObject#bounds(range)</tt></td><td>Takes an <tt class="classname">FXRange</tt> instance as its input and returns a (possibly modified) <tt class="classname">FXRange</tt> instance.</td></tr><tr><td><tt class="methodname">FXGLViewer#eyeToScreen(eye)</tt></td><td>Takes an array of eye coordinates (floats) as its input and returns the screen point coordinate as an array of integers [sx, sy]</td></tr><tr><td><tt class="methodname">FXGLViewer#getBoreVector(sx, sy)</tt></td><td>Returns the endpoint and direction vector as an array of arrays [point, dir]</td></tr><tr><td><tt class="methodname">FXGLViewer#light</tt></td><td>Returns a <tt class="classname">FXLight</tt> instance</td></tr><tr><td><tt class="methodname">FXGLViewer#viewport</tt></td><td>Returns an <tt class="classname">FXViewport</tt> instance.</td></tr><tr><td><tt class="methodname">FXPrinterDialog#printer</tt></td><td>Returns the <tt class="classname">FXPrinter</tt> instance</td></tr><tr><td><tt class="methodname">FXScrollArea#position</tt></td><td>Returns the position as an array of integers [x, y]</td></tr><tr><td><tt class="methodname">FXSlider#range</tt></td><td>Returns a <tt class="classname">Range</tt> instance.</td></tr><tr><td><tt class="methodname">FXSlider#range=(aRange)</tt></td><td>Accepts a <tt class="classname">Range</tt> instance as its input.</td></tr><tr><td><tt class="methodname">FXSpinner#range</tt></td><td>Returns a <tt class="classname">Range</tt> instance.</td></tr><tr><td><tt class="methodname">FXSpinner#range=(aRange)</tt></td><td>Accepts a <tt class="classname">Range</tt> instance as its input.</td></tr><tr><td><tt class="methodname">FXText#appendText(text, notify=false)</tt></td><td>Append text to the end of the buffer.</td></tr><tr><td><tt class="methodname">FXText#appendStyledText(text, style=0, notify=false)</tt></td><td>Append styled text to the end of the buffer.</td></tr><tr><td><tt class="methodname">FXText#extractText(pos, n)</tt></td><td>Extracts <span class="emphasis"><em>n</em></span> characters from the buffer beginning at position <span class="emphasis"><em>pos</em></span> and returns the result as a String.</td></tr><tr><td><tt class="methodname">FXText#extractStyle(pos, n)</tt></td><td>Extracts <span class="emphasis"><em>n</em></span> style characters from the buffer beginning at position <span class="emphasis"><em>pos</em></span> and returns the result as a String.</td></tr><tr><td><tt class="methodname">FXText#insertText(pos, text, notify=false)</tt></td><td>Insert <span class="emphasis"><em>text</em></span> at position <span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><tt class="methodname">FXText#insertStyledText(pos, text, style=0, notify=false)</tt></td><td>Insert <span class="emphasis"><em>text</em></span> at position <span class="emphasis"><em>pos</em></span> in the buffer.</td></tr><tr><td><tt class="methodname">FXText#replaceText(pos, m, text, notify=false)</tt></td><td>Replace <span class="emphasis"><em>m</em></span> characters at <span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><tt class="methodname">FXText#replaceStyledText(pos, m, text, style=0, notify=false)</tt></td><td>Replace <span class="emphasis"><em>m</em></span> characters at <span class="emphasis"><em>pos</em></span> by <span class="emphasis"><em>text</em></span>.</td></tr><tr><td><tt class="methodname">FXText#setDelimiters(delimiters)</tt></td><td>Change delimiters of words (<span class="emphasis"><em>delimiters</em></span> is a string).</td></tr><tr><td><tt class="methodname">FXText#getDelimiters()</tt></td><td>Return word delimiters as a string.</td></tr><tr><td><tt class="methodname">FXWindow#cursorPosition</tt></td><td>Returns an array of integers [x, y, buttons]</td></tr><tr><td><tt class="methodname">FXWindow#translateCoordinatesFrom(window, x, y)</tt></td><td>Returns the translated coordinates as an array [x, y]</td></tr><tr><td><tt class="methodname">FXWindow#translateCoordinatesTo(window, x, y)</tt></td><td>Returns the translated coordinates as an array [x, y]</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3886"></a>Iterators</h2></div></div><div></div></div><p>Several classes have been extended with an <tt class="methodname">each</tt> method to provide Ruby-style iterators. These classes include <tt class="classname">FXComboBox</tt>, <tt class="classname">FXGLGroup</tt>, <tt class="classname">FXHeader</tt>, <tt class="classname">FXIconList</tt>, <tt class="classname">FXList</tt>, <tt class="classname">FXListBox</tt>, <tt class="classname">FXTreeItem</tt>, <tt class="classname">FXTreeList</tt> and <tt class="classname">FXTreeListBox</tt>. These classes also mix-in Ruby's <tt class="classname">Enumerable</tt> module so that you can take full advantage of the iterators.</p><p>The block parameters passed to your code block vary depending on the class. For example, iterating over an <tt class="classname">FXList</tt> instance yields <tt class="classname">FXListItem</tt> parameters:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aList.each { |aListItem|
8
8
  puts "text for this item = #{aListItem.getText()}"
9
9
  }</pre></td></tr></table><p>whereas iterating over an <tt class="classname">FXComboBox</tt> instance yields two parameters, the item text (a string) and the item data:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aComboBox.each { |itemText, itemData|
10
10
  puts "text for this item = #{itemText}"
11
- }</pre></td></tr></table><p>The following table shows the block parameters for each of these classes' iterators:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Class</th><th align="center">Block Parameters</th></tr></thead><tbody><tr><td><tt class="classname">FXComboBox</tt></td><td>the item text (a string) and user data</td></tr><tr><td><tt class="classname">FXGLGroup</tt></td><td>an <tt class="classname">FXGLObject</tt> instance</td></tr><tr><td><tt class="classname">FXHeader</tt></td><td>an <tt class="classname">FXHeaderItem</tt> instance</td></tr><tr><td><tt class="classname">FXIconList</tt></td><td>an <tt class="classname">FXIconItem</tt> instance</td></tr><tr><td><tt class="classname">FXList</tt></td><td>an <tt class="classname">FXListItem</tt> instance</td></tr><tr><td><tt class="classname">FXListBox</tt></td><td>the item text (a string), icon (an <tt class="classname">FXIcon</tt> instance) and user data</td></tr><tr><td><tt class="classname">FXTreeItem</tt></td><td>an <tt class="classname">FXTreeItem</tt> instance</td></tr><tr><td><tt class="classname">FXTreeList</tt></td><td>an <tt class="classname">FXTreeItem</tt> instance</td></tr><tr><td><tt class="classname">FXTreeListBox</tt></td><td>an <tt class="classname">FXTreeItem</tt> instance</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e3988"></a>Attribute Accessors</h2></div></div><div></div></div><p>FOX strictly handles access to all object attributes through member functions, e.g. <tt class="methodname">setBackgroundColor</tt> and <tt class="methodname">getBackgroundColor</tt> or <tt class="methodname">setText</tt> and <tt class="methodname">getText</tt>. FXRuby exposes all of these functions but also provides aliases that look more like regular Ruby attribute accessors. The names for these accessors are based on the FOX method names; for example, <tt class="methodname">setBackgroundColor</tt> and <tt class="methodname">getBackgroundColor</tt> are aliased to <tt class="methodname">backgroundColor=</tt> and <tt class="methodname">backgroundColor</tt>, respectively.</p><p>In many cases these aliases allow you to write more compact and legible code. For example, consider this code snippet:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aLabel.setText(aLabel.getText() + " (modified)")</pre></td></tr></table><p>Now consider a different code snippet, using the aliased accessor method names:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aLabel.text += " (modified)"</pre></td></tr></table><p>While these two are functionally equivalent, the latter is a bit easier to read and understand at first glance.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4027"></a>Message Passing</h2></div></div><div></div></div><p>FOX message maps are implemented as static C++ class members. With FXRuby, you just associate messages with message handlers in the class <tt class="methodname">initialize</tt> method using the <tt class="methodname">FXMAPFUNC()</tt>, <tt class="methodname">FXMAPTYPE()</tt>, <tt class="methodname">FXMAPTYPES()</tt> or <tt class="methodname">FXMAPFUNCS()</tt> methods. See almost any of the example programs for examples of how this is done.</p><p>As in C++ FOX, the last argument passed to your message handler functions contains message-specific data. For instance, all <tt class="constant">SEL_PAINT</tt> messages pass an <tt class="classname">FXEvent</tt> object through this argument to give you some information about the size of the exposed rectangle. On the other hand, a <tt class="constant">SEL_COMMAND</tt> message from an <tt class="classname">FXHeader</tt> object passes the index of the selected header item through this argument. Instead of guessing what's in this last argument, your best bet is to instead invoke a member function on the sending object to find out what you need, instead of relying on the data passed through this pointer. For example, if you get a <tt class="constant">SEL_COMMAND</tt> message from an <tt class="classname">FXColorWell</tt> object, the data passed through that last argument is supposed to be the new RGB color value. Instead of trying to interpret the argument's contents, just turn around and call the color well's <tt class="methodname">getRGBA()</tt> member function to retrieve its color. Similarly, if you get a <tt class="constant">SEL_COMMAND</tt> message from a tree list, call its <tt class="methodname">getCurrentItem()</tt> method to find out which item was selected.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4076"></a>Catching Operating System Signals</h2></div></div><div></div></div><p>The <tt class="methodname">FXApp#addSignal</tt> and <tt class="methodname">FXApp#removeSignal</tt> methods have been enhanced to accept either a string or integer as their first argument. If it's a string (e.g. "SIGINT" or just "INT") the code will determine the corresponding signal number for you (similar to the standard Ruby library's <tt class="methodname">Process.kill</tt> module method). For examples of how to use this, see the <tt class="filename">datatarget.rb</tt> or <tt class="filename">imageviewer.rb</tt> example programs.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4096"></a>Support for Multithreaded Applications</h2></div></div><div></div></div><p>There is some support for multithreaded FXRuby applications, but it's not wonderful. The current implementation does what is also done in Ruby/GTK; it turns over some idle processing time to the Ruby thread scheduler to let other threads do their thing. As I learn more about Ruby's threading implementation I may try something different, but this seems to work OK for now. For a simple example, see the <tt class="filename">groupbox.rb</tt> example program, in which the clock label that appears in the lower right-hand corner is continuously updated (by a separate thread).</p><p>If you suspect that FXRuby's threads support is interfering with your application's performance, you may want to try tweaking the amount of time that the main application thread "sleeps" during idle processing; do this by setting the <tt class="classname">FXApp</tt> object's <i class="structfield"><tt>sleepTime</tt></i> attribute. The default value for <i class="structfield"><tt>FXApp#sleepTime</tt></i> is 100 milliseconds. You can also disable the threads support completely by calling <tt class="methodname">FXApp#threadsEnabled=false</tt> (and subsequently re-enable it with <tt class="methodname">FXApp#threadsEnabled=true</tt>).</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4121"></a>Debugging Tricks</h2></div></div><div></div></div><p>As a debugging tool, you can optionally catch exceptions raised in message handlers. To turn on this feature, call the <tt class="methodname">setIgnoreExceptions(true)</tt> module method. When this is enabled, any exceptions raised in message handler functions will cause a standard stack trace to be dumped to the standard output, but then your application will, for better or worse, proceed normally. Thanks to Ted Meng for this suggestion.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="scintilla.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="library.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix&nbsp;B.&nbsp;Using Scintilla with FXRuby&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Appendix&nbsp;D.&nbsp;The FXRuby Standard Library</td></tr></table></div></body></html>
11
+ }</pre></td></tr></table><p>The following table shows the block parameters for each of these classes' iterators:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th align="center">Class</th><th align="center">Block Parameters</th></tr></thead><tbody><tr><td><tt class="classname">FXComboBox</tt></td><td>the item text (a string) and user data</td></tr><tr><td><tt class="classname">FXGLGroup</tt></td><td>an <tt class="classname">FXGLObject</tt> instance</td></tr><tr><td><tt class="classname">FXHeader</tt></td><td>an <tt class="classname">FXHeaderItem</tt> instance</td></tr><tr><td><tt class="classname">FXIconList</tt></td><td>an <tt class="classname">FXIconItem</tt> instance</td></tr><tr><td><tt class="classname">FXList</tt></td><td>an <tt class="classname">FXListItem</tt> instance</td></tr><tr><td><tt class="classname">FXListBox</tt></td><td>the item text (a string), icon (an <tt class="classname">FXIcon</tt> instance) and user data</td></tr><tr><td><tt class="classname">FXTreeItem</tt></td><td>an <tt class="classname">FXTreeItem</tt> instance</td></tr><tr><td><tt class="classname">FXTreeList</tt></td><td>an <tt class="classname">FXTreeItem</tt> instance</td></tr><tr><td><tt class="classname">FXTreeListBox</tt></td><td>an <tt class="classname">FXTreeItem</tt> instance</td></tr></tbody></table></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4030"></a>Attribute Accessors</h2></div></div><div></div></div><p>FOX strictly handles access to all object attributes through member functions, e.g. <tt class="methodname">setBackgroundColor</tt> and <tt class="methodname">getBackgroundColor</tt> or <tt class="methodname">setText</tt> and <tt class="methodname">getText</tt>. FXRuby exposes all of these functions but also provides aliases that look more like regular Ruby attribute accessors. The names for these accessors are based on the FOX method names; for example, <tt class="methodname">setBackgroundColor</tt> and <tt class="methodname">getBackgroundColor</tt> are aliased to <tt class="methodname">backgroundColor=</tt> and <tt class="methodname">backgroundColor</tt>, respectively.</p><p>In many cases these aliases allow you to write more compact and legible code. For example, consider this code snippet:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aLabel.setText(aLabel.getText() + " (modified)")</pre></td></tr></table><p>Now consider a different code snippet, using the aliased accessor method names:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aLabel.text += " (modified)"</pre></td></tr></table><p>While these two are functionally equivalent, the latter is a bit easier to read and understand at first glance.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4069"></a>Message Passing</h2></div></div><div></div></div><p>FOX message maps are implemented as static C++ class members. With FXRuby, you just associate messages with message handlers in the class <tt class="methodname">initialize</tt> method using the <tt class="methodname">FXMAPFUNC()</tt>, <tt class="methodname">FXMAPTYPE()</tt>, <tt class="methodname">FXMAPTYPES()</tt> or <tt class="methodname">FXMAPFUNCS()</tt> methods. See almost any of the example programs for examples of how this is done.</p><p>As in C++ FOX, the last argument passed to your message handler functions contains message-specific data. For instance, all <tt class="constant">SEL_PAINT</tt> messages pass an <tt class="classname">FXEvent</tt> object through this argument to give you some information about the size of the exposed rectangle. On the other hand, a <tt class="constant">SEL_COMMAND</tt> message from an <tt class="classname">FXHeader</tt> object passes the index of the selected header item through this argument. Instead of guessing what's in this last argument, your best bet is to instead invoke a member function on the sending object to find out what you need, instead of relying on the data passed through this pointer. For example, if you get a <tt class="constant">SEL_COMMAND</tt> message from an <tt class="classname">FXColorWell</tt> object, the data passed through that last argument is supposed to be the new RGB color value. Instead of trying to interpret the argument's contents, just turn around and call the color well's <tt class="methodname">getRGBA()</tt> member function to retrieve its color. Similarly, if you get a <tt class="constant">SEL_COMMAND</tt> message from a tree list, call its <tt class="methodname">getCurrentItem()</tt> method to find out which item was selected.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4118"></a>Catching Operating System Signals</h2></div></div><div></div></div><p>The <tt class="methodname">FXApp#addSignal</tt> and <tt class="methodname">FXApp#removeSignal</tt> methods have been enhanced to accept either a string or integer as their first argument. If it's a string (e.g. "SIGINT" or just "INT") the code will determine the corresponding signal number for you (similar to the standard Ruby library's <tt class="methodname">Process.kill</tt> module method). For examples of how to use this, see the <tt class="filename">datatarget.rb</tt> or <tt class="filename">imageviewer.rb</tt> example programs.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4138"></a>Support for Multithreaded Applications</h2></div></div><div></div></div><p>There is some support for multithreaded FXRuby applications, but it's not wonderful. The current implementation does what is also done in Ruby/GTK; it turns over some idle processing time to the Ruby thread scheduler to let other threads do their thing. As I learn more about Ruby's threading implementation I may try something different, but this seems to work OK for now. For a simple example, see the <tt class="filename">groupbox.rb</tt> example program, in which the clock label that appears in the lower right-hand corner is continuously updated (by a separate thread).</p><p>If you suspect that FXRuby's threads support is interfering with your application's performance, you may want to try tweaking the amount of time that the main application thread "sleeps" during idle processing; do this by setting the <tt class="classname">FXApp</tt> object's <i class="structfield"><tt>sleepTime</tt></i> attribute. The default value for <i class="structfield"><tt>FXApp#sleepTime</tt></i> is 100 milliseconds. You can also disable the threads support completely by calling <tt class="methodname">FXApp#threadsEnabled=false</tt> (and subsequently re-enable it with <tt class="methodname">FXApp#threadsEnabled=true</tt>).</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e4163"></a>Debugging Tricks</h2></div></div><div></div></div><p>As a debugging tool, you can optionally catch exceptions raised in message handlers. To turn on this feature, call the <tt class="methodname">setIgnoreExceptions(true)</tt> module method. When this is enabled, any exceptions raised in message handler functions will cause a standard stack trace to be dumped to the standard output, but then your application will, for better or worse, proceed normally. Thanks to Ted Meng for this suggestion.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="scintilla.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt02.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="library.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix&nbsp;B.&nbsp;Using Scintilla with FXRuby&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Appendix&nbsp;D.&nbsp;The FXRuby Standard Library</td></tr></table></div></body></html>
@@ -1,9 +1,9 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Chapter&nbsp;5.&nbsp;Drag and Drop</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="ch04s04.html" title="Pasting Data from the Clipboard"><link rel="next" href="ch05s02.html" title="Drag Sources"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch05s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="dragdroptut"></a>Chapter&nbsp;5.&nbsp;Drag and Drop</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="dragdroptut.html#d0e1223">Drop Sites</a></dt><dt><a href="ch05s02.html">Drag Sources</a></dt><dt><a href="ch05s03.html">Putting It All Together</a></dt></dl></div><p>One of the more powerful features available to FOX applications is
3
+ <title>Chapter&nbsp;5.&nbsp;Drag and Drop</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="ch04s04.html" title="Pasting Data from the Clipboard"><link rel="next" href="ch05s02.html" title="Drag Sources"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;5.&nbsp;Drag and Drop</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s04.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch05s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="dragdroptut"></a>Chapter&nbsp;5.&nbsp;Drag and Drop</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="dragdroptut.html#d0e1201">Drop Sites</a></dt><dt><a href="ch05s02.html">Drag Sources</a></dt><dt><a href="ch05s03.html">Putting It All Together</a></dt></dl></div><p>One of the more powerful features available to FOX applications is
4
4
  drag-and-drop. It's also one of the more complicated to understand. For more
5
5
  background, see the standard FOX documentation on <a href="http://www.fox-toolkit.com/draganddrop.html" target="_top">Drag and
6
- Drop</a>.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1223"></a>Drop Sites</h2></div></div><div></div></div><p>We're going to start by presenting a skeleton application consisting
6
+ Drop</a>.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1201"></a>Drop Sites</h2></div></div><div></div></div><p>We're going to start by presenting a skeleton application consisting
7
7
  of a main window widget (a <tt class="classname">DropSite</tt> instance) that
8
8
  parents an <tt class="classname">FXCanvas</tt> widget:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">require 'rubygems'
9
9
  require_gem 'fxruby'
@@ -1,6 +1,6 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="examples.html" title="Chapter&nbsp;6.&nbsp;Examples"><link rel="next" href="todo.html" title="Chapter&nbsp;8.&nbsp;To-do list"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="examples.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="todo.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="events"></a>Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</h2></div></div><div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2049"></a>Background</h2></div></div><div></div></div><p>One of the biggest flaws with earlier releases of FXRuby was its strict reproduction of FOX's process for mapping GUI events (messages) to instance methods (handlers). That process involved four distinct steps:</p><div class="orderedlist"><ol type="1" compact><li><p>Initializing a <span class="emphasis"><em>message identifier</em></span>, an integer that helps to disambiguate the sender of the message and/or its purpose.</p></li><li><p>Mapping a specific message type and identifier to an instance method for the message target object.</p></li><li><p>Implementing the actual handler method in the message target.</p></li><li><p>Registering the message target and message identifier with the widget that's going to send the messages.</p></li></ol></div><p>So, for example, let's say you wanted to create a button widget that, when pressed, prints the string "Ouch!" to the terminal. In the old scheme of things, you'd need to identify some object to act as the target for any messages generated by this button. To keep things simple, let's say that the application's main window (<span class="emphasis"><em>mainWindow</em></span>) is designated as the target for the button. We'll need to generate a unique identifier associated with the button:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">class MyMainWindow &lt; FXMainWindow
3
+ <title>Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="examples.html" title="Chapter&nbsp;6.&nbsp;Examples"><link rel="next" href="todo.html" title="Chapter&nbsp;8.&nbsp;To-do list"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="examples.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="todo.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="events"></a>Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</h2></div></div><div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2027"></a>Background</h2></div></div><div></div></div><p>One of the biggest flaws with earlier releases of FXRuby was its strict reproduction of FOX's process for mapping GUI events (messages) to instance methods (handlers). That process involved four distinct steps:</p><div class="orderedlist"><ol type="1" compact><li><p>Initializing a <span class="emphasis"><em>message identifier</em></span>, an integer that helps to disambiguate the sender of the message and/or its purpose.</p></li><li><p>Mapping a specific message type and identifier to an instance method for the message target object.</p></li><li><p>Implementing the actual handler method in the message target.</p></li><li><p>Registering the message target and message identifier with the widget that's going to send the messages.</p></li></ol></div><p>So, for example, let's say you wanted to create a button widget that, when pressed, prints the string "Ouch!" to the terminal. In the old scheme of things, you'd need to identify some object to act as the target for any messages generated by this button. To keep things simple, let's say that the application's main window (<span class="emphasis"><em>mainWindow</em></span>) is designated as the target for the button. We'll need to generate a unique identifier associated with the button:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">class MyMainWindow &lt; FXMainWindow
4
4
 
5
5
  include Responder
6
6
 
@@ -9,7 +9,7 @@
9
9
  ... other stuff ...
10
10
  end</pre></td></tr></table><p>Next, you'd want to specify the mapping for a specific message type to the target's instance method that handles that message:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">FXMAPFUNC(SEL_COMMAND, MyMainWindow::ID_BUTTON, 'onCmdButton')</pre></td></tr></table><p>Finally, you'd need to implement the instance method (<tt class="methodname">onCmdButton</tt>) named in the call to <tt class="methodname">FXMAPFUNC</tt>:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">def onCmdButton(sender, sel, ptr)
11
11
  puts "Ouch!"
12
- end</pre></td></tr></table><p>The last step is to tell the button who it's message target is, and which message identifier to use when sending messages to that target:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aButton = FXButton.new(parent, "Push Me", nil, mainWindow, ID_BUTTON)</pre></td></tr></table><p>This was an extremely tedious process, especially for programmers who are used to Ruby/Tk's or Ruby/GTK's approach for connecting signals (events) to blocks that handle the signal. After some discussions at RubyConf 2001 and subsequent discussions on the Ruby newsgroup, a new model was proposed and hashed out on the RubyGarden Wiki. This new model was introduced with the FXRuby-0.99.179 release.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2097"></a>Event Model</h2></div></div><div></div></div><p>FXRuby implements a new, simplified approach to this built on top of the old model. It more or less mimics the syntax used in Ruby/GTK; you can attach a message handler block to a widget using a new <tt class="methodname">connect</tt> instance method, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aButton = FXButton.new(parent, "Push Me")
12
+ end</pre></td></tr></table><p>The last step is to tell the button who it's message target is, and which message identifier to use when sending messages to that target:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aButton = FXButton.new(parent, "Push Me", nil, mainWindow, ID_BUTTON)</pre></td></tr></table><p>This was an extremely tedious process, especially for programmers who are used to Ruby/Tk's or Ruby/GTK's approach for connecting signals (events) to blocks that handle the signal. After some discussions at RubyConf 2001 and subsequent discussions on the Ruby newsgroup, a new model was proposed and hashed out on the RubyGarden Wiki. This new model was introduced with the FXRuby-0.99.179 release.</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2075"></a>Event Model</h2></div></div><div></div></div><p>FXRuby implements a new, simplified approach to this built on top of the old model. It more or less mimics the syntax used in Ruby/GTK; you can attach a message handler block to a widget using a new <tt class="methodname">connect</tt> instance method, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aButton = FXButton.new(parent, "Push Me")
13
13
  aButton.connect(SEL_COMMAND) { |sender, sel, ptr|
14
14
  puts "Ouch!"
15
15
  }</pre></td></tr></table><p>Alternate forms of the <tt class="methodname">FXObject#connect</tt> method can take either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as a second argument (i.e. instead of attaching a block), e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">def push(sender, sel, ptr)
@@ -18,13 +18,13 @@ end
18
18
 
19
19
  aButton = FXButton.new(parent, "Push Me")
20
20
  aButton.connect(SEL_COMMAND, method(:push))</pre></td></tr></table><p>It works by creating a special target object (behind the scenes) that stands-in as the message target for your widget and passes off incoming messages to the appropriate block. The single argument to <tt class="methodname">connect</tt> is the FOX message type you're handling (e.g. <tt class="constant">SEL_COMMAND</tt>, <tt class="constant">SEL_CHANGED</tt>, etc.) The three arguments to the block are the same as those for regular FOX message handler methods, namely, the sender object, the message type and identifier and the message data. And of course, for simple handlers like this one, you can just leave the arguments off altogether:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aButton = FXButton.new(parent, "Push Me")
21
- aButton.connect(SEL_COMMAND) { puts "Ouch!" }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2133"></a>Timers</h2></div></div><div></div></div><p>Timers are scheduled by calling <tt class="methodname">FXApp#addTimeout</tt>. There are three different forms of <tt class="methodname">addTimeout</tt>, but the first argument to each is the timeout interval in milliseconds. The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle the timeout event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aTimer = getApp().addTimeout(1000, timeoutHandlerObj, ID_TIMER)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its second argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aTimer = getApp().addTimeout(1000, method(:timeoutHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the timeout event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aTimer = getApp().addTimeout(1000) { |sender, sel, ptr|
21
+ aButton.connect(SEL_COMMAND) { puts "Ouch!" }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2111"></a>Timers</h2></div></div><div></div></div><p>Timers are scheduled by calling <tt class="methodname">FXApp#addTimeout</tt>. There are three different forms of <tt class="methodname">addTimeout</tt>, but the first argument to each is the timeout interval in milliseconds. The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle the timeout event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aTimer = getApp().addTimeout(1000, timeoutHandlerObj, ID_TIMER)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its second argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aTimer = getApp().addTimeout(1000, method(:timeoutHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the timeout event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aTimer = getApp().addTimeout(1000) { |sender, sel, ptr|
22
22
  # handle this timeout event
23
- }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2160"></a>Chores</h2></div></div><div></div></div><p>Chores are scheduled by calling <tt class="methodname">FXApp#addChore</tt>. There are three different forms of <tt class="methodname">addChore</tt>; the most primitive version requires two arguments to specify the target object and message identifier for the object that will handle the chore event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aChore = getApp().addChore(choreHandlerObj, ID_CHORE)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its single argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aChore = getApp().addChore(method(:choreHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the chore:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aChore = getApp().addChore { |sender, sel, ptr|
23
+ }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2138"></a>Chores</h2></div></div><div></div></div><p>Chores are scheduled by calling <tt class="methodname">FXApp#addChore</tt>. There are three different forms of <tt class="methodname">addChore</tt>; the most primitive version requires two arguments to specify the target object and message identifier for the object that will handle the chore event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aChore = getApp().addChore(choreHandlerObj, ID_CHORE)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its single argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aChore = getApp().addChore(method(:choreHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the chore:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aChore = getApp().addChore { |sender, sel, ptr|
24
24
  # handle this chore
25
- }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2187"></a>Signals</h2></div></div><div></div></div><p>Operating system signal handlers are designated by calling <tt class="methodname">FXApp#addSignal</tt>. There are three different forms of <tt class="methodname">addSignal</tt>, but the first argument to each is the signal name (e.g. "SIGINT") or number. Each version also has two optional arguments (which should come at the end of the list) to specify <i class="parameter"><tt>immediate</tt></i> and <i class="parameter"><tt>flags</tt></i>. The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle this operating system signal:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aSignal = getApp().addSignal("SIGINT", signalHandlerObj, ID_SIGINT)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its second argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aSignal = getApp().addSignal("SIGINT", method(:signalHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the signal:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aSignal = getApp().addSignal("SIGINT") { |sender, sel, ptr|
25
+ }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2165"></a>Signals</h2></div></div><div></div></div><p>Operating system signal handlers are designated by calling <tt class="methodname">FXApp#addSignal</tt>. There are three different forms of <tt class="methodname">addSignal</tt>, but the first argument to each is the signal name (e.g. "SIGINT") or number. Each version also has two optional arguments (which should come at the end of the list) to specify <i class="parameter"><tt>immediate</tt></i> and <i class="parameter"><tt>flags</tt></i>. The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle this operating system signal:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aSignal = getApp().addSignal("SIGINT", signalHandlerObj, ID_SIGINT)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its second argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aSignal = getApp().addSignal("SIGINT", method(:signalHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the signal:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">aSignal = getApp().addSignal("SIGINT") { |sender, sel, ptr|
26
26
  # handle this signal
27
- }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2220"></a>Input Events</h2></div></div><div></div></div><p>Input event handlers are designated by calling <tt class="methodname">FXApp#addInput</tt>. There are three different forms of <tt class="methodname">addInput</tt>, but the first two arguments to each are the file object (including sockets) and the mode flag (some combination of <tt class="constant">INPUT_READ</tt>, <tt class="constant">INPUT_WRITE</tt> and <tt class="constant">INPUT_EXCEPT</tt>). The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle this input event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(aFile, INPUT_READ, inputHandlerObj, ID_INPUT)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its third argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(aSocket, INPUT_READ|INPUT_EXCEPT, method(:inputHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the input event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(aFile, INPUT_WRITE|INPUT_EXCEPT) { |sender, sel, ptr|
27
+ }</pre></td></tr></table></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2198"></a>Input Events</h2></div></div><div></div></div><p>Input event handlers are designated by calling <tt class="methodname">FXApp#addInput</tt>. There are three different forms of <tt class="methodname">addInput</tt>, but the first two arguments to each are the file object (including sockets) and the mode flag (some combination of <tt class="constant">INPUT_READ</tt>, <tt class="constant">INPUT_WRITE</tt> and <tt class="constant">INPUT_EXCEPT</tt>). The most primitive version of this method takes two additional arguments to specify the target object and message identifier for the object that will handle this input event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(aFile, INPUT_READ, inputHandlerObj, ID_INPUT)</pre></td></tr></table><p>The second form takes either a <tt class="classname">Method</tt> or <tt class="classname">Proc</tt> instance as its third argument, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(aSocket, INPUT_READ|INPUT_EXCEPT, method(:inputHandlerMethod))</pre></td></tr></table><p>The last form uses a code block as the handler for the input event:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(aFile, INPUT_WRITE|INPUT_EXCEPT) { |sender, sel, ptr|
28
28
  # handle this input
29
29
  }</pre></td></tr></table><p>This API is a little different from the other cases. For example, timeout events always send the same message type (<tt class="constant">SEL_TIMEOUT</tt>) to their message target, so you just have a single handler method (or block) to handle the timeout. In contrast, input sources (e.g. pipes or sockets) can generate three different FOX messages, <tt class="constant">SEL_IO_READ</tt>, <tt class="constant">SEL_IO_WRITE</tt> and <tt class="constant">SEL_IO_EXCEPTION</tt>, depending on what happens, so your handler method (block) needs to check the message type, e.g.</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">getApp().addInput(socket, INPUT_READ|INPUT_WRITE) { |sender, sel, ptr|
30
30
  case SELTYPE(sel)
@@ -1,12 +1,12 @@
1
1
  <html><head>
2
2
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3
- <title>Chapter&nbsp;6.&nbsp;Examples</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="ch05s03.html" title="Putting It All Together"><link rel="next" href="events.html" title="Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;6.&nbsp;Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="events.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="examples"></a>Chapter&nbsp;6.&nbsp;Examples</h2></div></div><div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1622"></a>hello</h2></div></div><div></div></div><p>The <a href="../examples/hello.rb" target="_top"><tt class="filename">hello.rb</tt></a>
3
+ <title>Chapter&nbsp;6.&nbsp;Examples</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"><link rel="home" href="book.html" title="Developing Graphical User Interfaces with FXRuby"><link rel="up" href="pt01.html" title="Part&nbsp;I.&nbsp;The Basics"><link rel="previous" href="ch05s03.html" title="Putting It All Together"><link rel="next" href="events.html" title="Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;6.&nbsp;Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;I.&nbsp;The Basics</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="events.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="examples"></a>Chapter&nbsp;6.&nbsp;Examples</h2></div></div><div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1600"></a>hello</h2></div></div><div></div></div><p>The <a href="../examples/hello.rb" target="_top"><tt class="filename">hello.rb</tt></a>
4
4
  example program is about as short as it gets for a working FXRuby program.
5
5
  Use this as a starting point for understanding the basic elements of an
6
6
  FXRuby program, especially if you're new to GUI programming in
7
- general.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1635"></a>hello2</h2></div></div><div></div></div><p>The <a href="../examples/hello2.rb" target="_top"><tt class="filename">hello2.rb</tt></a>
7
+ general.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1613"></a>hello2</h2></div></div><div></div></div><p>The <a href="../examples/hello2.rb" target="_top"><tt class="filename">hello2.rb</tt></a>
8
8
  example kicks it up a notch by adding an icon and tooltip to the button
9
- from the <tt class="filename">hello.rb</tt> example.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello2.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1651"></a>scribble</h2></div></div><div></div></div><p>The <a href="../examples/scribble.rb" target="_top"><tt class="filename">scribble.rb</tt></a>
9
+ from the <tt class="filename">hello.rb</tt> example.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/hello2.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1629"></a>scribble</h2></div></div><div></div></div><p>The <a href="../examples/scribble.rb" target="_top"><tt class="filename">scribble.rb</tt></a>
10
10
  example is a good demonstration of how to obtain a device context for a
11
11
  window (in this case, an <tt class="classname">FXCanvas</tt>) and draw into
12
12
  that window. It also provides a basic demonstration of how FOX's GUI
@@ -14,9 +14,9 @@
14
14
  widgets based on the application's state. Observe the "Clear"
15
15
  button becoming enabled and disabled (greyed-out) depending on whether the
16
16
  canvas is currently "dirty" or "clean", and then see how
17
- this updating is actually handled in the code.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/scribble.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1667"></a>button</h2></div></div><div></div></div><p>The <a href="../examples/button.rb" target="_top"><tt class="filename">button.rb</tt></a>
17
+ this updating is actually handled in the code.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/scribble.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1645"></a>button</h2></div></div><div></div></div><p>The <a href="../examples/button.rb" target="_top"><tt class="filename">button.rb</tt></a>
18
18
  example program shows off the various options (or button styles) for
19
- <tt class="classname">FXButton</tt> widgets.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/button.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1683"></a>datatarget</h2></div></div><div></div></div><p>The <a href="../examples/datatarget.rb" target="_top"><tt class="filename">datatarget.rb</tt></a>
19
+ <tt class="classname">FXButton</tt> widgets.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/button.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1661"></a>datatarget</h2></div></div><div></div></div><p>The <a href="../examples/datatarget.rb" target="_top"><tt class="filename">datatarget.rb</tt></a>
20
20
  example program demonstrates most or all of the widgets that can work with
21
21
  FOX data targets (that is, instances of class <tt class="classname">FXDataTarget</tt>).
22
22
  Data targets are special objects that have a a string, float or integer
@@ -28,63 +28,63 @@
28
28
  target's value is changed, the text field will update its setting.
29
29
  Since a single data targets can be attached to multiple widgets, this can
30
30
  be a useful way to keep multiple controls for the same logical value in
31
- sync with each other.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/datatarget.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1699"></a>dialog</h2></div></div><div></div></div><p>The <a href="../examples/dialog.rb" target="_top"><tt class="filename">dialog.rb</tt></a>
31
+ sync with each other.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/datatarget.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1677"></a>dialog</h2></div></div><div></div></div><p>The <a href="../examples/dialog.rb" target="_top"><tt class="filename">dialog.rb</tt></a>
32
32
  example is a simple program demonstrating how to construct and display
33
- modal and non-modal dialog boxes.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dialog.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1712"></a>dirlist</h2></div></div><div></div></div><p>The <a href="../examples/dirlist.rb" target="_top"><tt class="filename">dirlist.rb</tt></a>
33
+ modal and non-modal dialog boxes.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dialog.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1690"></a>dirlist</h2></div></div><div></div></div><p>The <a href="../examples/dirlist.rb" target="_top"><tt class="filename">dirlist.rb</tt></a>
34
34
  example program demonstrates the <tt class="classname">FXDirList</tt> widget.
35
35
  The directory list is a special kind of tree list, where each tree item
36
- represents a directory (or folder) in the file system.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dirlist.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1728"></a>iconlist</h2></div></div><div></div></div><p>The <a href="../examples/iconlist.rb" target="_top"><tt class="filename">iconlist.rb</tt></a>
36
+ represents a directory (or folder) in the file system.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dirlist.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1706"></a>iconlist</h2></div></div><div></div></div><p>The <a href="../examples/iconlist.rb" target="_top"><tt class="filename">iconlist.rb</tt></a>
37
37
  example program demonstrates the <tt class="classname">FXIconList</tt> widget.
38
38
  An icon list is a special kind of list widget that can display its
39
39
  contents in one of three basic modes (details mode, small icons mode or
40
40
  large icons mode). The first screenshot below shows an icon list in
41
41
  details mode, while the second shows the same icon list in "big
42
- icons" mode.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/iconlist-details.png" align="middle"></div></div><div class="screenshot"><div class="mediaobject" align="center"><img src="images/iconlist-bigicons.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1748"></a>mditest</h2></div></div><div></div></div><p>The <a href="../examples/mditest.rb" target="_top"><tt class="filename">mditest.rb</tt></a>
42
+ icons" mode.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/iconlist-details.png" align="middle"></div></div><div class="screenshot"><div class="mediaobject" align="center"><img src="images/iconlist-bigicons.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1726"></a>mditest</h2></div></div><div></div></div><p>The <a href="../examples/mditest.rb" target="_top"><tt class="filename">mditest.rb</tt></a>
43
43
  example program demonstrates FOX's Multiple Document Interface (MDI)
44
44
  capabilities, specifically the <tt class="classname">FXMDIClient</tt> and
45
- <tt class="classname">FXMDIChild</tt> classes.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/mditest.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1767"></a>groupbox</h2></div></div><div></div></div><p>The <a href="../examples/groupbox.rb" target="_top"><tt class="filename">groupbox.rb</tt></a>
45
+ <tt class="classname">FXMDIChild</tt> classes.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/mditest.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1745"></a>groupbox</h2></div></div><div></div></div><p>The <a href="../examples/groupbox.rb" target="_top"><tt class="filename">groupbox.rb</tt></a>
46
46
  example program is a kind of "periodic table of widgets"
47
47
  demonstration, FOX-style. It shows off a lot of the FOX widgets as well as
48
- providing a good exercise of FOX's layout managers.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/groupbox.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1780"></a>header</h2></div></div><div></div></div><p>The <a href="../examples/header.rb" target="_top"><tt class="filename">header.rb</tt></a>
48
+ providing a good exercise of FOX's layout managers.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/groupbox.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1758"></a>header</h2></div></div><div></div></div><p>The <a href="../examples/header.rb" target="_top"><tt class="filename">header.rb</tt></a>
49
49
  example program mainly demonstrates the <tt class="classname">FXHeader</tt>
50
- widget and the <tt class="classname">FXSplitter</tt> layout manager.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/header.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1799"></a>image</h2></div></div><div></div></div><p>The <a href="../examples/image.rb" target="_top"><tt class="filename">image.rb</tt></a>
50
+ widget and the <tt class="classname">FXSplitter</tt> layout manager.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/header.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1777"></a>image</h2></div></div><div></div></div><p>The <a href="../examples/image.rb" target="_top"><tt class="filename">image.rb</tt></a>
51
51
  example demonstrates how to draw directly into an <tt class="classname">FXImage</tt>
52
- object and then "draw" that image into a canvas.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/image.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1815"></a>splitter</h2></div></div><div></div></div><p>The <a href="../examples/splitter.rb" target="_top"><tt class="filename">splitter.rb</tt></a>
52
+ object and then "draw" that image into a canvas.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/image.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1793"></a>splitter</h2></div></div><div></div></div><p>The <a href="../examples/splitter.rb" target="_top"><tt class="filename">splitter.rb</tt></a>
53
53
  example demonstrates the <tt class="classname">FXSplitter</tt> layout manager.
54
54
  It also provides an example of the <tt class="classname">FXTreeList</tt>
55
55
  widget (on the left side of the split) and the <tt class="classname">FXMatrix</tt>
56
- layout manager (in the middle pane).</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/splitter.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1837"></a>foursplit</h2></div></div><div></div></div><p>The <a href="../examples/foursplit.rb" target="_top"><tt class="filename">foursplit.rb</tt></a>
56
+ layout manager (in the middle pane).</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/splitter.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1815"></a>foursplit</h2></div></div><div></div></div><p>The <a href="../examples/foursplit.rb" target="_top"><tt class="filename">foursplit.rb</tt></a>
57
57
  example program demonstrates the <tt class="classname">FX4Splitter</tt> layout
58
58
  manager. This four-way split is especially useful for CAD-type programs
59
59
  where it's necessary to show multiple views of the model
60
- simultaneously.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/foursplit.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1853"></a>shutter</h2></div></div><div></div></div><p>The <a href="../examples/shutter.rb" target="_top"><tt class="filename">shutter.rb</tt></a>
60
+ simultaneously.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/foursplit.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1831"></a>shutter</h2></div></div><div></div></div><p>The <a href="../examples/shutter.rb" target="_top"><tt class="filename">shutter.rb</tt></a>
61
61
  example provides a simple demonstration of the <tt class="classname">FXShutter</tt>
62
62
  widget, with the skeleton of a PIM-type application. The very nice icons
63
- used for this program are courtesy of <a href="http://www.forrestwalter.com/icons" target="_top">Gort's Icons</a>.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/shutter.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1872"></a>tabbook</h2></div></div><div></div></div><p>The <a href="../examples/tabbook.rb" target="_top"><tt class="filename">tabbook.rb</tt></a>
63
+ used for this program are courtesy of <a href="http://www.forrestwalter.com/icons" target="_top">Gort's Icons</a>.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/shutter.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1850"></a>tabbook</h2></div></div><div></div></div><p>The <a href="../examples/tabbook.rb" target="_top"><tt class="filename">tabbook.rb</tt></a>
64
64
  example exists mainly to demonstrate the <tt class="classname">FXTabBook</tt>
65
- widget, but shows off a few other features in the process.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/tabbook.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1888"></a>table</h2></div></div><div></div></div><p>The <a href="../examples/table.rb" target="_top"><tt class="filename">table.rb</tt></a>
65
+ widget, but shows off a few other features in the process.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/tabbook.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1866"></a>table</h2></div></div><div></div></div><p>The <a href="../examples/table.rb" target="_top"><tt class="filename">table.rb</tt></a>
66
66
  example features the <tt class="classname">FXTable</tt> widget, sometimes
67
67
  known as a "grid" or "spreadsheet" widget in other
68
- toolkits.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/table.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1904"></a>gltest</h2></div></div><div></div></div><p>The <a href="../examples/gltest.rb" target="_top"><tt class="filename">gltest.rb</tt></a>
68
+ toolkits.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/table.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1882"></a>gltest</h2></div></div><div></div></div><p>The <a href="../examples/gltest.rb" target="_top"><tt class="filename">gltest.rb</tt></a>
69
69
  example program demonstrates how to create a basic OpenGL canvas (i.e. an
70
70
  instance of the <tt class="classname">FXGLCanvas</tt> widget) and draw into
71
71
  it. It also demonstrates how to use timers and chores. This example
72
72
  requires the Ruby/OpenGL extension, available from the Ruby Application
73
- Archive.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/gltest.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1920"></a>glviewer</h2></div></div><div></div></div><p>The <a href="../examples/glviewer.rb" target="_top"><tt class="filename">glviewer.rb</tt></a>
73
+ Archive.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/gltest.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1898"></a>glviewer</h2></div></div><div></div></div><p>The <a href="../examples/glviewer.rb" target="_top"><tt class="filename">glviewer.rb</tt></a>
74
74
  example program demonstrates how to use the <tt class="classname">FXGLViewer</tt>
75
75
  widget and draw various kinds of GL objects into it. It can also be used
76
76
  as model for a fairly complicated FXRuby application, since it includes a
77
- lot of typical features (like a menu bar, toolbar, status line, etc.).</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/glviewer.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1936"></a>imageviewer</h2></div></div><div></div></div><p>Like the <a href="../examples/glviewer.rb" target="_top"><tt class="filename">glviewer.rb</tt></a>
77
+ lot of typical features (like a menu bar, toolbar, status line, etc.).</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/glviewer.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1914"></a>imageviewer</h2></div></div><div></div></div><p>Like the <a href="../examples/glviewer.rb" target="_top"><tt class="filename">glviewer.rb</tt></a>
78
78
  example, the <a href="../examples/imageviewer.rb" target="_top"><tt class="filename">imageviewer.rb</tt></a>
79
79
  can be used as a model for a typical full-featured GUI application, with a
80
80
  menu bar, toolbar, and so forth. It also features the
81
- <tt class="classname">FXImageView</tt> widget.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/imageviewer.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1956"></a>dilbert</h2></div></div><div></div></div><p>The <a href="../examples/dilbert.rb" target="_top"><tt class="filename">dilbert.rb</tt></a>
81
+ <tt class="classname">FXImageView</tt> widget.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/imageviewer.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1934"></a>dilbert</h2></div></div><div></div></div><p>The <a href="../examples/dilbert.rb" target="_top"><tt class="filename">dilbert.rb</tt></a>
82
82
  example fetches the "Daily Dilbert" cartoon and displays it in a
83
83
  window. This was just a fun little exercise for me, but it does provide a
84
84
  more bare-bones example of the <tt class="classname">FXImageView</tt> widget
85
85
  than that provided by the (more complicated) <tt class="filename">imageviewer.rb</tt>
86
86
  example.</p><p>This example program requires the html-parser extension, available
87
- from the Ruby Application Archive.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dilbert.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1977"></a>raabrowser</h2></div></div><div></div></div><p>The <a href="../examples/raabrowser.rb" target="_top"><tt class="filename">raabrowser.rb</tt></a>
87
+ from the Ruby Application Archive.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/dilbert.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1955"></a>raabrowser</h2></div></div><div></div></div><p>The <a href="../examples/raabrowser.rb" target="_top"><tt class="filename">raabrowser.rb</tt></a>
88
88
  example program shows a treelist view of the current Ruby Application
89
89
  Archive (RAA) contents, and product-specific information for the currently
90
90
  selected product in the panel on the right. This is a good demonstration
@@ -95,10 +95,10 @@
95
95
  the tree) try resizing the split.</p></li><li style="list-style-type: disc"><p>the <tt class="classname">FXTreeList</tt> widget, used to display
96
96
  the RAA contents.</p></li><li style="list-style-type: disc"><p>data targets (i.e. instances of class <tt class="classname">FXDataTarget</tt>),
97
97
  which are used for the contents of the fields in the information
98
- panel.</p></li></ul></div><p>This example program requires the <a href="http://www.jin.gr.jp/~nahi/Ruby/SOAP4R" target="_top">SOAP4R</a> extension.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/raabrowser.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2014"></a>babelfish</h2></div></div><div></div></div><p>The <a href="../examples/babelfish.rb" target="_top"><tt class="filename">babelfish.rb</tt></a>
98
+ panel.</p></li></ul></div><p>This example program requires the <a href="http://www.jin.gr.jp/~nahi/Ruby/SOAP4R" target="_top">SOAP4R</a> extension.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/raabrowser.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1992"></a>babelfish</h2></div></div><div></div></div><p>The <a href="../examples/babelfish.rb" target="_top"><tt class="filename">babelfish.rb</tt></a>
99
99
  example program, like the <tt class="filename">raabrowser.rb</tt> example,
100
100
  depends on the <a href="http://www.jin.gr.jp/~nahi/Ruby/SOAP4R" target="_top">SOAP4R</a>
101
- extension. Other than that it doesn't bring anything new to the table.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/babelfish.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2033"></a>browser</h2></div></div><div></div></div><p>The <a href="../examples/browser.rb" target="_top"><tt class="filename">browser.rb</tt></a>
101
+ extension. Other than that it doesn't bring anything new to the table.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/babelfish.png" align="middle"></div></div></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2011"></a>browser</h2></div></div><div></div></div><p>The <a href="../examples/browser.rb" target="_top"><tt class="filename">browser.rb</tt></a>
102
102
  example program is mainly a "me too" for the class browser
103
103
  distributed with Ruby/GTK. It's hard for me to get excited about it,
104
104
  but here it is.</p><div class="screenshot"><div class="mediaobject" align="center"><img src="images/browser.png" align="middle"></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch05s03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="events.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Putting It All Together&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="book.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;7.&nbsp;FXRuby's Message-Target System</td></tr></table></div></body></html>