<div class="gmail_quote">On Wed, Jan 28, 2009 at 2:32 PM, Lyle Johnson <span dir="ltr">&lt;<a href="mailto:lyle@lylejohnson.name">lyle@lylejohnson.name</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div class="Ih2E3d"><br><div><div>On Jan 28, 2009, at 2:55 AM, dave L wrote:</div><br><blockquote type="cite"><span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>
<div style="font-family:&#39;times new roman&#39;, &#39;new york&#39;, times, serif;font-size:12pt;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
here is my source<br><br>require &quot;inchesX&quot;<br>Class inchesX<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #events<br>&nbsp; def init<br><br>&nbsp;&nbsp;&nbsp; convertButton.connect(SEL_COMMAND){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmLabel.text = (inchesField.text.to_f * 2.54).to_s}<br>
&nbsp; end<br><br><br>#unit test<br>if __FILE__==$0<br>&nbsp;&nbsp;&nbsp; require &quot;FX&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; app=App.new<br>&nbsp;&nbsp;&nbsp; w=inchesX.new app<br>&nbsp;&nbsp;&nbsp; w.topwin.show(0)<br>&nbsp;&nbsp;&nbsp; app.create<br>&nbsp;&nbsp;&nbsp; app.run<br>end<br><br>and here is the error i get when run from teh terminal (using kate to code wit a terminal at the bottom so i don&#39;t have to flick between windows/programs.<br>
<br>dave@AMD3000:/spare/foxgui$ ruby ExtendInches.rb<br>ExtendInches.rb:2: undefined local variable or method `inchesX&#39; for main:Object (NameError)</div></div></div></span></blockquote><br></div></div><div>This is an odd-looking program. It&#39;s tough to know where to begin.</div>
<div><br></div><div>One obvious problem you&#39;re running into is that class names in Ruby must begin with an uppercase letter. You will need to rename your &quot;inchesX&quot; class to &quot;InchesX&quot;.</div><div><br>
</div><div>Also, the code that you&#39;re showing is incomplete:</div><div><br></div><div><span style="white-space:pre">        </span>class inchesX<br></div><div class="Ih2E3d"><div><span style="white-space:pre">                </span>def init<br>
</div><div><span style="white-space:pre">                        </span>convertButton.connect(SEL_COMMAND) {&nbsp;cmLabel.text = (inchesField.text.to_f*2.54).to_s }</div><div><span style="white-space:pre">                </span>end<br></div><div><br></div></div>
<div>There&#39;s no &quot;end&quot; statement corresponding to the &quot;class&quot; statement, so I&#39;m surprised this parsed at all. What does the contents of the &quot;inchesX.rb&quot; file look like?</div><div><br></div>
<div>In your main program (i.e. the part in the &quot;if __FILE__&quot; block), you call:</div><div><br></div><div><span style="white-space:pre">        </span>inchesX.new app<br></div><div><br></div><div>but unless the code in &quot;inchesX.rb&quot; contains a corresponding initialize() method, that&#39;s not going to work either. </div>
</div></blockquote><div>&nbsp;<br></div><div>yes it will, because the initialize method is defined in the source file generated by foxGUIb. this example in the users guide is about keeping manual additions separated from generated code in order to be able to re-generate it.<br>
<br>-- henon</div></div>