Forum: wxRuby wxRuby error: Image file is not of type 9

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.
Omar H. (Guest)
on 2008-10-18 04:01
Hello

I'm having problems with rhis error, I couldnt found the solution (or
even mention) on the internet

I'm doing a toolbar, called @toolBarPrincipal, then I add the tool,and
finally the #realize() method.

This error happens when openig the file (on windows, linux ran pretty
well)
I still can work with the program but the icon (or bitmap or whatever)
doesnt shows.

The Code is:

@toolBarPrincipal=create_tool_bar(TB_HORIZONTAL | NO_BORDER | TB_FLAT |
TB_TEXT )
@toolBarPrincipal.add_tool(-1, 'Bonzai2',
Bitmap.new("C:/rubyCode/icons/bonsai.ico"))
@toolBarPrincipal.realize()


also tryed:
@toolBarPrincipal.add_tool(-1, 'Bonzai2',
Bitmap.new("C:/rubyCode/icons/bonsai.bmp"))

Renaming the file or savin as from mspaint, but no good.

Does anyone knows how to solve it?

Thanks
Alex F. (Guest)
on 2008-10-18 18:47
(Received via mailing list)
Omar H. wrote:
> @toolBarPrincipal=create_tool_bar(TB_HORIZONTAL | NO_BORDER | TB_FLAT |
> TB_TEXT )
> @toolBarPrincipal.add_tool(-1, 'Bonzai2',
> Bitmap.new("C:/rubyCode/icons/bonsai.ico"))

Try adding the type argument to tell wxRuby what type of image file
you're loading from

Wx::Bitmap.new("/path/to/icon.ico", Wx::BITMAP_TYPE_ICO)

See the Wx::Bitmap documentation for a list of supported types. For
cross-platform use, I'd recommend using PNG over ICO or BMP

hth
alex
Omar H. (Guest)
on 2008-11-12 02:35
> Try adding the type argument to tell wxRuby what type of image file
> you're loading from
>
> Wx::Bitmap.new("/path/to/icon.ico", Wx::BITMAP_TYPE_ICO)
>
> See the Wx::Bitmap documentation for a list of supported types. For
> cross-platform use, I'd recommend using PNG over ICO or BMP
>
> hth
> alex

Thanks, it's working fine.
This topic is locked and can not be replied to.