Hrm, I had checked that but nothing had shown up. Thanks guys!

On Sun, Jul 12, 2009 at 7:25 AM, Seth Thomas Rasmussen <
[email protected]> wrote:

> On Sun, Jul 12, 2009 at 12:23 AM, Timothy McDowell<[email protected]>
> wrote:
> > ef roll die
> >   a = nil
> >   if (a = die.match(/([0-9]+)d([0-9]+)/))
> >     answer = 0
> >     a[1].to_i.times do
> >       answer += rand(a[2].to_i) + 1
> >     end
> >     return answer
> >   else
> >    para "Not a valid die type."
> >   end
> > end
> > Shoes.app do
> >   @text = para "Type a die roll into the box, and then hit enter. Ie:
> 2d6"
> >   flow do
> >     @editline = edit_line
> >   end
> >   keypress do |k|
> >     case k
> >       when :enter
> >         a = roll @editline.text
> >         para a.to_s
> >         @text.replace a
> >     end
> >   end
> > end
> > There is my code. I know my 'roll' method works fine. When I hit 'enter'
> > when the editline has focus, nothing happens... any help?
>
> Put the :roll method def inside the Shoes.app block. Then it will be
> defined on the instance of Shoes::App which is what self is inside
> that block.
>
> Next time "nothing happens", check out the error console. You might
> see something like an error about any unknown method which will tip
> you off to a solution.
>
> --
> Seth Thomas Rasmussen
> http://greatseth.com
>



-- 
--Brains.

Reply via email to