From RubyCocoa to wxRuby?

hey all,

thanks to alex who help me to get the latest running on my box ( Mac OS
X
10.4.11)

to get it working download the latest gem locally cd to the directory
where
it lies and :
$ sudo gem install --local wxruby

u’ll get :
Successfully installed wxruby-1.9.7-universal-darwin-9
1 gem installed

:wink:

A question, my first test will be to convert a RubyCocoa project into
wxRuby.

this project convert the AddressBook contents into html
( a preview :
http://thoraval.yvon.free.fr/AB2Html_preview/ab2html.xhtml

what do I need ?

a push button, a spinner and a text area to give feedback to the user
that’
all :wink:

( a screenshot : http://cjoint.com/data/fkqRia4sT5.htm

what is the best example to start with in such a context ?

is it possible to use the AddressBook framework from wxRuby ?

in that case i’ll only the UI to rewrite…

best,

yvon

2008/5/10 Alex F. [email protected]:

Glad we figured it out. Something that other users may want to be aware of
is that Rubygems seems not to be offering the latest gems to OS X 10.4
users.

this is true for rubygems itself…
i was unable to update to *
1.1.1http://rubyforge.org/frs/shownotes.php?release_id=21058

    • of 11/04/2008 00:06, may be i’ll try again with the same
      procedure…*

A question, my first test will be to convert a RubyCocoa project into

wxRuby.

Out of interest, may I ask why you’re looking to make this switch?

threads probs with RubyCocoa ?
Xplatform too
also this project is the simplest to start with wxRuby.

Sizers are the best way to lay out widgets; there is a reasonably detailed
discussion of how to use them in the documentation for Wx::Sizer.

is it possible to use the AddressBook framework from wxRuby ?

You should be able to use RubyCocoa to access that framework without
problems inside wxRuby. It’s not something I know much about though.

i know that part, i’ve done ruby script to extend some of this framework
classes (ABGroup, ABPerson and ABAddressBook.sharedAddressBook class
instance)

in that case i’ll only the UI to rewrite…

Yep, well hopefully if your existing code has the UI and export code
reasonably separate it shouldn’t be a tricky job.

my export code is as simple as :
@address_book.to_xml

(each classe has it’s own #to_xml method…)
the remaining code is devoted to save files at the right place (under
~/Sites)

good luck and feel free to ask for help on this list

thanks for your advices !

Yvon T. wrote:

thanks to alex who help me to get the latest running on my box ( Mac
OS X 10.4.11)

to get it working download the latest gem locally cd to the directory
where it lies and :
$ sudo gem install --local wxruby

u’ll get :
Successfully installed wxruby-1.9.7-universal-darwin-9
1 gem installed

Glad we figured it out. Something that other users may want to be aware
of is that Rubygems seems not to be offering the latest gems to OS X
10.4 users.

A question, my first test will be to convert a RubyCocoa project into
wxRuby.
Out of interest, may I ask why you’re looking to make this switch?

what is the best example to start with in such a context ?

The classes you want will be Wx::Button, Wx::AnimationCtrl, and
Wx::StaticText or Wx::TextCtrl. You may want to place them all on a
Wx::Panel.

For a sample to use as a starting point, you could look at
text/textctrl.rb which organises a few widgets using sizers and links up
a button event. Sizers are the best way to lay out widgets; there is a
reasonably detailed discussion of how to use them in the documentation
for Wx::Sizer.

is it possible to use the AddressBook framework from wxRuby ?

You should be able to use RubyCocoa to access that framework without
problems inside wxRuby. It’s not something I know much about though.

in that case i’ll only the UI to rewrite…

Yep, well hopefully if your existing code has the UI and export code
reasonably separate it shouldn’t be a tricky job.

good luck and feel free to ask for help on this list

alex

Yvon T. wrote:**

    A question, my first test will be to convert a RubyCocoa
    project into wxRuby.

Out of interest, may I ask why you're looking to make this switch?

threads probs with RubyCocoa ?

If you need to use ruby threads in your application, also look at the
threaded.rb sample. Threads work OK with wxRuby, but you need to make
sure that the background non-GUI tasks are allocated some time, and try
to avoid calling GUI code outside the main thread. There are numerous
threads about threads on the mailing list.

a

2008/5/10 Alex F. [email protected]:

Yvon T. wrote:**

threads probs with RubyCocoa ?

If you need to use ruby threads in your application, also look at the
threaded.rb sample. Threads work OK with wxRuby, but you need to make sure
that the background non-GUI tasks are allocated some time, and try to avoid
calling GUI code outside the main thread.

ok, i see.

There are numerous threads about threads on the mailing list.

:wink: