wxRuby error: Image file is not of type 9


#1

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


#2

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


#3

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.