The widget born from this snippets (in lib\shoes.rb) - read docs
around for the 'inherited' method.

def Widget.inherited subc
    Shoes.class_eval %{
      def #{subc.to_s[/(^|::)(\w+)$/, 2].
            gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
            gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase}(*a, &b)
        a.unshift #{subc}
        widget(*a, &b)
      end
    }
  end

-------------------------------------

About the ducomentation: you have to retrieve it googling around, the
best 'ref' in this moment is the response _why gives to a post by
Martin DeMello.

Original response:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/304372


Post on hackety extending the resp (examples):

http://hackety.org/2008/06/12/martinDemellosGooeyChallenge.html

--------------------

Some snippets (of comment)


"The `initialize` part works because every widget is just a canvas anyway.
And the `draw` method is called every time there's a repaint."

"When you inherit from Widget, you get a free lowercased method added
to Shoes for inserting that widget into any "stack" or "flow" (like
HTML divs, basically.)"

"And since the widget itself is a "flow", you can move the whole widget
as a single component.  So you can call `move(x, y)` or `show` or
`hide` on the object returned by the `browse` method."

Hope it helps



On Sun, Oct 5, 2008 at 12:45 PM, Jo Vermeulen <[EMAIL PROTECTED]>wrote:

>
>
> Is there any documentation about the interface of Widget?
>
> I was wondering if there is something like a Paint method (maybe 'draw')
> that I can use to draw its contents. I'm doing everything in the initialize
> method now. It would be nice to be able to update the widget, and just call
> its draw method again, knowing that this draw method would actually be used
> to draw the widget's contents everytime.
>
> -- Jo
>
>

Reply via email to