[fxruby-users] FXMainWindow

Lyle Johnson lyle at lylejohnson.name
Mon Jul 21 09:10:49 EDT 2008

On Mon, Jul 21, 2008 at 3:39 AM, MAwiniarski <MAwiniarski at gmail.com> wrote:

> Greetings,
> I want to add icon to window using:
> mainWindow = FXMainWindow.new(app, "Window Title",
>                              "icon.ico", nil, DECOR_ALL,
>                              mainWindowX, mainWindowY,
>                              mainWindowWidth, mainWindowHeight)
> and get error:
> wrong argument type String (expected Data) (TypeError)
> if I put nil instead everything works fine, so
> so it's about "icon.ico"
> what is a proper way of initializing icons?

The small icon and large icon arguments need to be references to
FXIcon objects. Try this instead:

    icon = FXICOIcon.new(app, File.open("icon.ico", "rb").read)
    mainWindow = FXMainWindow.new(app, "Window Title", icon, ...)

Hope this helps,


More information about the fxruby-users mailing list