Constants not recognized?

I just upgraded to wxRuby 2 and am having the following issue… With
code like this:

dd = Wx::DirDialog.new(@dialog,
‘Select the folder to process…’,
File.join(@home, ‘Desktop’),
Wx::DD_DEFAULT_STYLE | Wx::DD_DIR_MUST_EXIST |
Wx::DD_CHANGE_DIR)
dd.show_modal == Wx::ID_OK ? @basedir = dd.get_path : exit

I get the following error:

uninitialized constant Wxruby2::DD_DEFAULT_STYLE (NameError)

When I remove the style flags I get no such error… Ideas?

I am on Mac OS X and I installed via the rubyforge gem…

Tim F. wrote:

I just upgraded to wxRuby 2 and am having the following issue… With
code like this:

What version did you upgrade from?

dd = Wx::DirDialog.new(@dialog,
‘Select the folder to process…’,
File.join(@home, ‘Desktop’),
Wx::DD_DEFAULT_STYLE | Wx::DD_DIR_MUST_EXIST |
Wx::DD_CHANGE_DIR)
dd.show_modal == Wx::ID_OK ? @basedir = dd.get_path : exit

I get the following error:

uninitialized constant Wxruby2::DD_DEFAULT_STYLE (NameError)

Those constants look to be missing, thanks for the report. But I don’t
believe any recent change has done this.

To work around this for now you can add the defines yourself:

Wx::DD_DEFAULT_STYLE = Wx::DEFAULT_DIALOG_STYLE|Wx::RESIZE_BORDER
Wx::DD_CHANGE_DIR = 0x0100
Wx::DD_DIR_MUST_EXIST = 0x0200

a

Alex F. wrote:

What version did you upgrade from?

1.9.5 I think … but this is new code anyway. I do know that the FD_*
constants were working and are not now as well… maybe that helps?

Those constants look to be missing, thanks for the report. But I don’t
believe any recent change has done this.

To work around this for now you can add the defines yourself:

Wx::DD_DEFAULT_STYLE = Wx::DEFAULT_DIALOG_STYLE|Wx::RESIZE_BORDER
Wx::DD_CHANGE_DIR = 0x0100
Wx::DD_DIR_MUST_EXIST = 0x0200

Great - thanks for that!

Cheers,
Tim

Tim F. wrote:

1.9.5 I think … but this is new code anyway. I do know that the FD_*
constants were working and are not now as well… maybe that helps?

Correction - only Wx::FD_DEFAULT_STYLE seems to be undefined…

Tim F. wrote:

1.9.5 I think … but this is new code anyway. I do know that the FD_*
constants were working and are not now as well… maybe that helps?

I don’t think these have ever existed in wxRuby 1.9.x (though they
should have).

Correction - only Wx::FD_DEFAULT_STYLE seems to be undefined…

Thanks again:

Wx::FD_DEFAULT_STYLE = Wx::FD_OPEN

alex

Alex F. wrote:

I don’t think these have ever existed in wxRuby 1.9.x (though they
should have).

That is probably the case … I went back and looked at a deployed app I
had and I had used Wx::FD_OPEN instead of Wx::FD_DEFAULT_STYLE then
anyway…

Thanks!
Tim