Forum: wxRuby Mac OS X 10.5 installation and cross-platform questions

9e7e1fa694211d5a1618962734e5cb48?d=identicon&s=25 Roger Sperberg (rsperberg)
on 2010-04-23 19:01
I'm just beginning to learn wxRuby. I'm working on a WinXP sp3 machine,
and I expect to test Linux using VirtualBox and Ubuntu and to test Mac
OS X 10.5 on my wife's Mac mini.

On her Mac, I got Ruby 1.9.1p376 installed following Dan Benjamin's
instructions at http://hivelogic.com/articles/ruby-rails-leopard

(Yes, "which ruby" yields /usr/local/bin/ruby and "ruby -v" results in
ruby 1.9.1p376 (2009-12-07 rev 26041) [i386_darwin9.8.0] )

I then followed his instructions for installing RubyGems. And then
installed the wxRuby gem.

My simple program creating 4 tall, colored buttons (I've put a zip of
this at
http://sites.google.com/site/thecalculatorproject/...
if you want to see it) worked exactly as expected on WinXP. I'm
attaching a screen capture showing what it looks like on Windows.

On OS X, the program runs performs the few simple actions I built in,
but it has almost none of the button colors and sizes spec'd. (Sorry I
don't have a capture of the result.)

Since this is my first trial, I haven't really thought through the best
way to represent a design that Windows, MacOS and Linux can all
represent unambiguously. So if you look at my code and think, "Wow,
that's not the way to do this!" I won't be surprised.

However, I'm not really sure I have got wxRuby installed properly on the
Mac. Do I need to install wxWidgets independently? (I did install
wxWidgets separately on WinXP.)

Since I have only sporadic access to this Mac, I haven't yet tried
running the example files and comparing the results with what I see on
Windows (haven't gotten to Ubuntu yet either).

Any thoughts on this process so far? Any obvious missteps I ought to
correct? Any guidance on how to confirm I have got everything needed for
things to run properly?

Thanks,

Roger Sperberg

rsperberg at gmail
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2010-04-23 19:31
(Received via mailing list)
Hi Roger

On 23/04/2010 18:01, Roger Sperberg wrote:
> (Yes, "which ruby" yields /usr/local/bin/ruby and "ruby -v" results in
> ruby 1.9.1p376 (2009-12-07 rev 26041) [i386_darwin9.8.0] )
>

If you've done this, and ruby -rubygems <program.rb> runs a wxruby
script, then you've almost certainly installed wxRuby and ruby
correctly.

> On OS X, the program runs performs the few simple actions I built in,
> but it has almost none of the button colors and sizes spec'd. (Sorry I
> don't have a capture of the result.)
>
> Since this is my first trial, I haven't really thought through the best
> way to represent a design that Windows, MacOS and Linux can all
> represent unambiguously.
>

I haven't looked at your code, just at the screenshot. A few comments
about the approach wxRuby takes, inheriting from wxWidgets might be
helpful: in general, it allows the application designer to describe what
each interactive element (eg button) should be doing, and where they
should be - in relation to one another. wxRuby/Widgets takes this
expression of intention and uses each OS's native GUI toolkit to
represent it visually on the screen. On Mac, push buttons are always
that apple-y grey; frame close/min/max buttons are always on the top
left and are red/yellow/green. That's what the Apple UI guidelines say;
that's what Apple's UI toolkit allows. It happens that Windows is more
permissive/incoherent, depending on your view, so the button styles
you've set actually apply.

It really depends what kind of interactive app you're trying to create.
wxRuby is a way of creating apps that will look "right", function
"right" and interact with the wider desktop in the "right" way on
different platforms. They seek to build on users' existing experience of
how GUI appliccations work to provide ease of use. Though it is very
flexible and customisable, it's less well suited to apps which seek to
create a very specific visual feel (down to exact pixels and button
shapes). There are important times for such apps - but eg Flash is a
more tailored environment for building them.

hth
alex
9e7e1fa694211d5a1618962734e5cb48?d=identicon&s=25 Roger Sperberg (rsperberg)
on 2010-04-23 20:18
Alex Fenton wrote:
> Hi Roger
>
> On 23/04/2010 18:01, Roger Sperberg wrote:
>> (Yes, "which ruby" yields /usr/local/bin/ruby and "ruby -v" results in
>> ruby 1.9.1p376 (2009-12-07 rev 26041) [i386_darwin9.8.0] )
>>
>
> If you've done this, and ruby -rubygems <program.rb> runs a wxruby
> script, then you've almost certainly installed wxRuby and ruby
> correctly.

Thanks for the confirmation!


>> I haven't really thought through the best
>> way to represent a design that Windows, MacOS and Linux can all
>> represent unambiguously.
>>

> It really depends what kind of interactive app you're trying to create.
> wxRuby is a way of creating apps that will look "right", function
> "right" and interact with the wider desktop in the "right" way on
> different platforms. ... Though it is very
> flexible and customisable, it's less well suited to apps which seek to
> create a very specific visual feel (down to exact pixels and button
> shapes). There are important times for such apps - but eg Flash is a
> more tailored environment for building them.
>
> hth
> alex

Absolutely. My comments aren't a complaint about wxWidgets.

In fact, what I am trying to do in this simple program is reduce a
calculator to its bare essentials: two number keys (to simplify
troubleshooting — first number added or second?), plus and equals; while
still resembling the calculator that will be the final version.

In earlier versions I've made, I used bitmap images for the keys.
However,  using standard buttons seemed simpler as an overall process to
explain (and, of course, coloring them and changing their shape to make
them more calculator-like so the kids following my steps wouldn't get
discouraged from the first pass through the problem).

Obviously if OS X interprets the appearance instructions this
differently for the standard button widget, I'd better rethink the
"example reduced to its simplest parts." For the complete calculator, I
expect to use Wx::BitmapButton and want only for the general look to be
the same, not identical results on different platforms.

Thanks for taking the time to respond to my post.

Roger

rsperberg at gmail
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2010-04-23 22:59
(Received via mailing list)
On 23/04/2010 19:18, Roger Sperberg wrote:
> Obviously if OS X interprets the appearance instructions this
> differently for the standard button widget, I'd better rethink the
> "example reduced to its simplest parts." For the complete calculator, I
> expect to use Wx::BitmapButton and want only for the general look to be
> the same, not identical results on different platforms.
>

Yes, Wx::BitmapButton is the way to go, I think. The fact that all
Windows (widgets) have a colour= method is a bit deceptive, as it
implies that it'll be honoured. As you've found OS X standard UI buttons
(and lots of others) don't have any concept of a "colour", or indeed of
a "size" (other than "Normal", "Small" and "Mini" scale - which are
accessed differently)

best
alex
9e7e1fa694211d5a1618962734e5cb48?d=identicon&s=25 Roger Sperberg (rsperberg)
on 2010-04-24 21:05
Attachment: addingmachine_v11_Mac.png (10 KB)
Alex Fenton wrote:
> On 23/04/2010 19:18, Roger Sperberg wrote:
> The fact that all
> Windows (widgets) have a colour= method is a bit deceptive, as it
> implies that it'll be honoured. As you've found OS X standard UI buttons
> (and lots of others) don't have any concept of a "colour", or indeed of
> a "size" (other than "Normal", "Small" and "Mini" scale - which are
> accessed differently)
>

I got onto the Mac mini here and ran the program again, this time
remembering to make a screen capture. (To repeat: this is the same code
that is rendered in the first screen capture, from Win XP.)

It is as you said.

The button background colors that I used actually do show up, filling
the space between the pill-shaped button and the rectangular space it
occupies.

Roger

rsperberg at gmail
This topic is locked and can not be replied to.