Forum: Ruby wxRuby setting the Frame's icon - getting started example

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.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-24 12:08
The following is a simplified example from the wxRuby wiki here:

http://wxruby.rubyforge.org/wiki/wiki.pl?Frames_(Part_1)

It's the second example in the wxRuby tutorial entitled "Getting
Started".  However, I don't seen any icon when I run the code on mac osx
10.4.11.


require 'rubygems'
require 'wx'

class IconFrame < Wx::Frame

  def initialize
    super(nil, -1, "Changing Icons", Wx::DEFAULT_POSITION,
          Wx::Size.new(300, 200)
          )

    set_icon(Wx::Icon.new("./icons/DataHD.png"))

    show
  end

end

class MinimalApp < Wx::App
  def on_init
    IconFrame.new
  end
end

MinimalApp.new.main_loop


I also tried using some .ico files in set_icon(), but I don't see them
anywhere.
F52a217f68b0d4db49ce2ceb06f79691?d=identicon&s=25 Alex Fenton (Guest)
on 2009-03-24 12:51
(Received via mailing list)
7stud -- wrote:
> The following is a simplified example from the wxRuby wiki here:
>
> http://wxruby.rubyforge.org/wiki/wiki.pl?Frames_(Part_1)
>
> It's the second example in the wxRuby tutorial entitled "Getting
> Started".  However, I don't seen any icon when I run the code on mac osx
> 10.4.11.

Frames in the OS X desktop don't have icons - not in the same way as
Windows has per-frame icons in the top-left corner.

If you want to set an application-wide icon to appear in the Dock, use
Wx::TaskBarIcon. There's an example of this in the bigdemo.rb sample
that comes with wxRuby.

PS - wxRuby questions are better on the wxruby-users mailing list:

http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists
http://www.ruby-forum.com/forum/36

a
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-24 13:09
Alex Fenton wrote:
> 7stud -- wrote:
>> The following is a simplified example from the wxRuby wiki here:
>>
>> http://wxruby.rubyforge.org/wiki/wiki.pl?Frames_(Part_1)
>>
>> It's the second example in the wxRuby tutorial entitled "Getting
>> Started".  However, I don't seen any icon when I run the code on mac osx
>> 10.4.11.
>
> Frames in the OS X desktop don't have icons - not in the same way as
> Windows has per-frame icons in the top-left corner.
>
> If you want to set an application-wide icon to appear in the Dock, use
> Wx::TaskBarIcon. There's an example of this in the bigdemo.rb sample
> that comes with wxRuby.
>
> PS - wxRuby questions are better on the wxruby-users mailing list:
>
> http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists
> http://www.ruby-forum.com/forum/36
>

Thanks for the response.  Ok.  Maybe the wiki should mention that?

By the way, did you see my results here:

http://www.ruby-forum.com/topic/180219#new
This topic is locked and can not be replied to.