Constants not recognized?


#1

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…


#2

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


#3

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


#4

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…


#5

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


#6

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