Forum: wxRuby Lazy WxRuby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
45196398e9685000d195ec626d477f0e?d=identicon&s=25 Thomas Sawyer (7rans)
on 2009-06-08 04:16
(Received via mailing list)
If interested I posted an example of how I lazily build a WxRuby
interface for an app. Here's the link via DZone:

  http://www.dzone.com/links/wxruby_for_the_lazy.html

T.
00109e19a784b64f81b483a5dbec690a?d=identicon&s=25 Chauk-Mean Proum (chauk-mean)
on 2009-06-08 21:47
(Received via mailing list)
Hi Trans,

On Mon, Jun 8, 2009 at 4:14 AM, trans<transfire@gmail.com> wrote:
> If interested I posted an example of how I lazily build a WxRuby
> interface for an app. Here's the link via DZone:
>
>  http://www.dzone.com/links/wxruby_for_the_lazy.html
>

Interesting approach.

Just some comments on wxRuby usage or style :
1/ You don't need to supply -1 as the ID parameter for a Window (-1 or
Wx::ID_ANY is already the default value).
For a window, the only mandatory parameter is the parent window (the
first parameter).

=>
def notebook
      @notebook ||= (
        notebook = Wx::Notebook.new(frame_panel)
        frame_sizer.add(notebook, 1, Wx::GROW)
        notebook
      )
    end

2/ Wx::Bitmap is smart enough to guess the bitmap type based on the
file extension (OK, it's not well documented but I'll fix that).
Wx::Toolbar has also the add_item method which support keyword
arguments (and it's well documented) :

 @search_start_tool   = toolbar.add_tool(-1, 'Start'   ,
            Wx::Bitmap.new(DIR + '/images/search.gif',
Wx::BITMAP_TYPE_GIF), 'Start')

=>

@search_start_tool   = toolbar.add_item(Wx::Bitmap.new(DIR +
'/images/search.gif'), :label => 'Start', :short_help => 'Start')

Cheers.

Chauk-Mean.
45196398e9685000d195ec626d477f0e?d=identicon&s=25 Thomas Sawyer (7rans)
on 2009-06-08 22:30
(Received via mailing list)
On Jun 8, 3:20 pm, Chauk-Mean Proum <chauk.m...@gmail.com> wrote:
>
> Interesting approach.

Thanks. The approach really helped me wrap my head around WxRuby
better.

>         frame_sizer.add(notebook, 1, Wx::GROW)
>             Wx::Bitmap.new(DIR + '/images/search.gif',
> Wx::BITMAP_TYPE_GIF), 'Start')
>
> =>
>
> @search_start_tool   = toolbar.add_item(Wx::Bitmap.new(DIR +
> '/images/search.gif'), :label => 'Start', :short_help => 'Start')

Nice tips. I'll apply those.

Thanks for taking at look at this.

T.
2aa32559134aa3d596fb749f8ffccde7?d=identicon&s=25 hendra kusuma (Guest)
on 2009-06-09 05:11
(Received via mailing list)
On Tue, Jun 9, 2009 at 3:27 AM, trans <transfire@gmail.com> wrote:

> > 1/ You don't need to supply -1 as the ID parameter for a Window (-1 or
> >       )
> >
> > =>
> >
> > @search_start_tool   = toolbar.add_item(Wx::Bitmap.new(DIR +
> > '/images/search.gif'), :label => 'Start', :short_help => 'Start')
>
> Nice tips. I'll apply those.
>
> Thanks for taking at look at this.
>

Perhaps I'm still too lazy for this :)
But your approaching is cool
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2009-06-17 13:58
(Received via mailing list)
trans wrote:
> If interested I posted an example of how I lazily build a WxRuby
> interface for an app. Here's the link via DZone:
>
>   http://www.dzone.com/links/wxruby_for_the_lazy.html

Late to the link, but thanks for posting this. I think the approach is
interesting and instructive so I added it to the tutorials page on the
wiki.

Another shortcut you can use:

Wx::VBoxSizer.new

instead of

Wx::BoxSizer.new(Wx::VERTICAL)

alex
45196398e9685000d195ec626d477f0e?d=identicon&s=25 Thomas Sawyer (7rans)
on 2009-06-17 16:16
(Received via mailing list)
On Jun 17, 7:56 am, Alex Fenton <a...@pressure.to> wrote:
> trans wrote:
> > If interested I posted an example of how I lazily build a WxRuby
> > interface for an app. Here's the link via DZone:
>
> >  http://www.dzone.com/links/wxruby_for_the_lazy.html
>
> Late to the link, but thanks for posting this. I think the approach is
> interesting and instructive so I added it to the tutorials page on the wiki.

Nice :-)

> Another shortcut you can use:
>
> Wx::VBoxSizer.new
>
> instead of
>
> Wx::BoxSizer.new(Wx::VERTICAL)

Thanks, I updated the post to use this.

Btw, just for completeness sake, the Controller class should also have
this method:

  def sites ; service.sites ; end


trans
This topic is locked and can not be replied to.